-
Notifications
You must be signed in to change notification settings - Fork 4
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
Refresh stale forms after 30 min of no change #1256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the form initially loads or reloads (on ready:form
), set the refreshForm()
function to run in 30 min.
When the user makes a change to the form (represented by the updateStoredSubmission()
function being called), set a new refreshForm()
to be called in 30 min.
When the user submits the form, cancel the scheduled refreshForm()
function.
@@ -48,6 +51,8 @@ export default App.extend({ | |||
}, | |||
readyForm() { | |||
this.trigger('ready'); | |||
|
|||
this.refreshForm(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially put this in the initialize()
function. But if a user is prompted with the keep/discard work prompt, this.refreshForm()
would be called before the actual form has been shown to the user.
So I put it here instead. To wait until the form content is loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct to me
@paulfalgout cool, I'll get some tests created for this. |
29ce24b
to
841afad
Compare
1 flaky test on run #6338 ↗︎
Details:
test/integration/forms/form.js • 1 flaky test • care-ops-e2e
Review all test suite changes for PR #1256 ↗︎ |
Pull Request Test Coverage Report for Build 970992bc-5fda-453c-ba4b-3a79aa95267cDetails
💛 - Coveralls |
841afad
to
88d4f3d
Compare
88d4f3d
to
30777a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is designed to simulate a user having a form open in their browser that becomes "stale". And after 30 minutes of inactivity, we reload the form so the current state of the form is displayed to the user.
Test sequence:
- Load an empty form.
- Restart the form after 30 minutes of no changes (via
cy.tick()
). The form is reloaded with a new draft latest form response.- Simulating a form draft having been created in a different tab/window/session.
- Verify that the form loaded the latest form response data into the form.
- Restart the form after 30 more minutes of no changes (via
cy.tick()
). The form is reloaded with a new submitted form response.- Simulating a form draft having been submitted in a different tab/window/session.
- Verify that the form is now submitted. Content shown should be from the submitted form response and the submit button should be in the
Update
state.
Shortcut Story ID: [sc-50208]