Preview: Open new window if prior preview window closed #8446
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.
This pull request seeks to resolve an issue where the Preview button will do nothing in some circumstances where a preview had been shown earlier but closed.
Implementation notes:
The user flow here is very specific because of how the
componentDidUpdate
unsets the preview window, thus allowing new windows to be opened if either the previous tab was initially closed or left open, but not if closed after left open and previewed multiple times.As a follow-up task, I think the save process should be made more durable by restoring the behavior of
componentDidUpdate
operating onisAutosaving
. It used to be this way, but was made to be more generic. Making it specific to the autosaving flow enables handling error cases as well, rather than letting the failed preview window linger open. It also prevents needing awkwardnesses around deleting thepreviewWindow
instance variable, which is only needed because we're attempting to be unaware of the autosave flow.End-to-end tests are planned to be written, but cannot be done so currently with failing Docker builds (#8418).
Testing instructions:
Verify that a preview is shown in the following set of steps:
Ensure that a preview is shown.
closes #8996