This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Populate StubItem panes that are deserialized after package initialization #2415
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.
Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.
Requirements
Description of the Change
We use
StubItems
to temporarily deserialize React-managed pane items, like the git or GitHub tabs, before the React tree is initialized and actually renders DOM elements within them to make them useful. The<PaneItem>
component handles the logic of finding and "hydrating" any stubs that were deserialized from persisted workspace state on Atom launch. However, it's possible that StubItems will be deserialized directly into the workspace after the package is initialized, and<PaneItem>
will never find them!As a result, a user who opens a project after Atom has been launched - for example, from the
File -> Reopen Project
menu - will be stuck with blank stub panels until they close and re-open the items.To fix this, let's watch newly added pane items on the workspace, detect when they're stubs that we don't already own, and hydrate them anyway.
Screenshot/Gif
Before:
After:
(TBD)
Alternate Designs
I'd love to revisit the way that
StubItems
work... I think we could simplify that way that they're created and managed to have a single "Item" class that's used consistently regardless of whether the item was opened through the<PaneItem>
-registered opener function or deserialized from project state. That's a heavier change though and I feel like it'd risk introducing more regressions than it would fix, so I'm preferring the band-aid fix for now.Benefits
At least one class of scenarios that would result in orphaned, blank StubItems will be patched.
Possible Drawbacks
We'll need to do more work on each pane item opening. This could result in performance impacts when large numbers of items are open, although I'll try to avoid it.
Applicable Issues
Fixes #2414.
Metrics
N/A
Tests
Following the verification steps in the linked issue, and adding unit tests.
Documentation
N/A
Release Notes
User Experience Research (Optional)
N/A