-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): TabGroup reliablity changes, uncloseable tabs
A couple pathological behaviors can happen with the TabGroup that this commit attempts to resolve: - The `TabGroupItem` elements are always mounted *after* the `TabGroup` itself, and may be mounted much later than other reactive portions of the page. This means that the call to `selectTab` can fail because the `TabGroupItem` has not yet had a chance to call `registerTab` on the TabGroup ref. To solve this I've added a ref that tracks a failed selectTab. If that tab is registered after the select call, and no other tab selection has occurred, we automatically select the "pending" tab. For the AssetEditorTabs this also means that calls to `nextTick` are unnecessary since the missing tab will just be marked as pending and will be selected when the `registerTab` call succeeds. - Teleports into other components rendered by Vue (instead of to portions of the DOM not handled by Vue) are unreliable. Consider the following chain of events: 1. a TabGroup is rendered. 2. the TabGroup items are rendered, and the active one attempts to render itself via a teleport. 3. Before that happens, the TabGroup itself is re-rendered for some reason. 4. At that point in time, the teleport target might not be present in the DOM, and the Teleport will fail (I saw this often while building the AssetEditorTabs), crashing the frontend JS execution. While in some cases this happens because too many renders are occuring, it's still possible for it to happen via perfectly normal rendering paths, for example if you switch from one Asset to the next one before one of the TabGroupItem teleports has had the chance to teleport into the (now destroyed) TabGroup. `vue-safe-teleport` solves this by providing a teleport target that is queried for its ready state, and only mounting the `Teleport` element when the target is ready. See vuejs/core#2015 for details on this issue. This also adds the ability to mark a single tab as uncloseable if the tab group has closeable = true.
- Loading branch information
1 parent
7cb2244
commit 991aaf5
Showing
5 changed files
with
93 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.