Preserve inputs by only refreshing parts of the page #787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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