Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubmissionController bug fix #3118

Merged
merged 7 commits into from May 23, 2022
Merged

SubmissionController bug fix #3118

merged 7 commits into from May 23, 2022

Conversation

yeasinhossain-dsi
Copy link
Collaborator

No description provided.

@@ -283,9 +283,9 @@ export class SubmissionController {
) {
delete declaration.data[attachmentSectionKey]
}
this.store.dispatch(writeDeclaration(declaration))
await this.store.dispatch(writeDeclaration(declaration))
Copy link
Collaborator

@rikukissa rikukissa May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was happening before adding these awaits? Did some changes get overwritten by some action creator? writeDeclaration is quite widely used throughout the app. Do we need to await use await elsewhere too? If I recall right, action dispatching should be fire-and-forget, and waiting for the result is a bit of an anti-pattern

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, submissionStatus was getting overridden when there were multiple declarations.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where exactly did it get overwritten? I'm thinking if we could fix it so writeDeclaration wouldn't overwrite the status of other declarations?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree. Instead of replacing all the declarations in the successActionCreator of WRITE_DECLARATION, only replacing the declaration we're writing should solve our issues.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We debugged this with Yeasin and it turns out, it's workqueue auto-update that causes this issue. Basically, it can happen that while the offline queue is processing, the logic meant to keep workqueues up-to-date triggers, messing the local state of the applications. That logic is also currently built into SubmissionController

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want to get rid of the work-queue auto update in the next release. The user experience isnt great and if it is causing side effects like this, then it is another good reason to get rid

@codecov
Copy link

codecov bot commented May 19, 2022

Codecov Report

Merging #3118 (f37c8ea) into develop (7782651) will decrease coverage by 0.02%.
The diff coverage is 64.54%.

@@             Coverage Diff             @@
##           develop    #3118      +/-   ##
===========================================
- Coverage    79.91%   79.88%   -0.03%     
===========================================
  Files          598      602       +4     
  Lines        27690    27721      +31     
  Branches      8797     8815      +18     
===========================================
+ Hits         22129    22146      +17     
- Misses        5506     5520      +14     
  Partials        55       55              
Impacted Files Coverage Δ
packages/client/src/App.tsx 100.00% <ø> (ø)
packages/client/src/declarations/index.ts 74.95% <ø> (ø)
packages/client/src/forms/configuration/default.ts 41.17% <ø> (ø)
packages/client/src/generate-form.ts 0.00% <ø> (ø)
packages/client/src/navigation/index.ts 59.86% <ø> (ø)
...ackages/client/src/views/OfficeHome/components.tsx 47.36% <ø> (ø)
packages/client/src/views/RecordAudit/queries.ts 100.00% <ø> (ø)
...s/metrics/src/features/metrics/metricsGenerator.ts 15.41% <0.00%> (-0.07%) ⬇️
...lient/src/views/RecordAudit/ActionDetailsModal.tsx 6.09% <6.09%> (ø)
packages/client/src/views/RecordAudit/History.tsx 35.89% <35.89%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5025980...f37c8ea. Read the comment docs.

@cypress
Copy link

cypress bot commented May 21, 2022



Test summary

29 0 0 0Flakiness 1


Run details

Project OpenCRVS Core
Status Passed
Commit 4c7980c ℹ️
Started May 23, 2022 7:26 AM
Ended May 23, 2022 7:36 AM
Duration 09:32 💡
OS Linux Ubuntu - 20.04
Browser Chrome 101

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/team.spec.ts Flakiness
1 Team Integration Test > Tests National Admin can Reactivate an user

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@rikukissa rikukissa merged commit d05304d into develop May 23, 2022
@rikukissa rikukissa deleted the ocrvs-2936 branch May 23, 2022 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants