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

Preserve inputs by only refreshing parts of the page #787

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

etiennebarrie
Copy link
Member

We've added support to have multiple runs of the same task in 2.0, but it's pretty frustrating when the task has attributes and you want to fill some values in the task page, because the page gets refreshed after 3 seconds, and we don't have a way to stop that.

Instead of replacing the entire <body>, this PR only replaces some parts of the page, which allows to preserve the inputs.

This turned out to be a bit flaky because previously with the perform_enqueued_jobs as a block, it was running the jobs inline, so by the time the page was refreshed, the job was already succeeded, which wasn't always the case when clicking Run and then performing the jobs.

This does mean the test now relies on the refresh working, which is a nice side effect, but I had to increase the wait time to make sure the page was refreshed via JavaScript in the test. Now we can see the value in the input isn't lost by the refresh.

cc @joelpinheiro who reported the issue

Copy link
Contributor

@adrianna-chang-shopify adrianna-chang-shopify left a comment

Choose a reason for hiding this comment

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

Gave it a 🎩 , love it! Great improvement over replacing the entire page. Nice to not need the scrollTo to force refreshes in Safari anymore either.

@etiennebarrie etiennebarrie merged commit fbdceb4 into main Mar 28, 2023
@etiennebarrie etiennebarrie deleted the dont-refresh-inputs branch March 28, 2023 13:31
@etiennebarrie etiennebarrie mentioned this pull request Apr 19, 2023
lawrencewong pushed a commit to lawrencewong/maintenance_tasks that referenced this pull request Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants