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

Investigate async submission saving #970

Open
jabrah opened this issue Jun 26, 2019 · 2 comments
Open

Investigate async submission saving #970

jabrah opened this issue Jun 26, 2019 · 2 comments

Comments

@jabrah
Copy link
Contributor

jabrah commented Jun 26, 2019

This would be a straightforward code change to do (in workflow) page transitions while asynchronously saving the submission. This differs from the current situation, where the submission is persisted, then the transition occurs, potentially causing a user noticeable delay in page transitions.

This is potentially related to an anomalous transition behavior where sometimes a workflow step will flash quickly before transitioning correctly to the next page.

While the code change is straightforward, we need to be sure that this does not have any negative impact on subsequent routes.

Note: I wouldn't think that subsequent routes would be effected, as the operation only persists changes that already exist in the client Store.

@jabrah
Copy link
Contributor Author

jabrah commented Jun 26, 2019

Lines like this are responsible for this behavior. We could take this opportunity to refactor the submission saving code perhaps to a Mixin so this saving code is not repeated as much as it is currently.

https://github.com/OA-PASS/pass-ember/blob/master/app/controllers/submissions/new/basics.js#L63:

this.get('submission').save().then(() => this.transitionToRoute(gotoRoute));

@jabrah
Copy link
Contributor Author

jabrah commented Aug 20, 2019

On the surface this is a simple fix. A quick experiment of simply pulling the transition out of the save Promise resulted in much faster page loading, but I am not convinced that it would the subsequent page would load correctly consistently.

Some workflow steps rely on data persisted on the Submission in order to render the UI correctly. We need to wait for the save to complete either before or after the transition.

We could potentially observe the Submission (Ember Data) property isSaving and only trigger the appropriate service calls when the submission.isSaving is false. This way we could transition to the next workflow step and update the model when the submission save is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant