-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/remove navigator derived state (#6107)
**Problem** Currently, we recalculate `getNavigatorTargets` twice per frame, even during canvas interactions where we know we won't use the results for rendering the frame. **Spike discovery** What if we remove getNavigatorTargets from DerivedState and instead turn it into a memoized selector? **Details** * create selector `navigatorTargetsSelector`, and try to use it from every component that accessed derivedState.navigatorTargets or derivedState.navigatorRows or derivedState.visibleNavigatorTargets * create helper `getNavigatorTargetsFromEditorState` for all the Action handler functions so they can keep using navigator targets without it being in the DerivedState * fix _a ton_ of test code so it uses `getNavigatorTargetsFromEditorState`. this is the majority of the diff **Evaluation** I think the approach is very promising! Especially for frames during canvas interactions where we want to disable most of the editor chrome, the selectors give us a very clean way to _completely avoid_ calculations that are not directly necessary for updating the canvas. I would like to continue to kill the rest of derived state in the same vein. I believe I am over the halfway point, because navigatorTargets was the majority of uses in our codebase.
- Loading branch information
1 parent
7e555e9
commit 05efe98
Showing
38 changed files
with
1,212 additions
and
712 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
197 changes: 106 additions & 91 deletions
197
.../canvas/canvas-strategies/strategies/absolute-reparent-to-flex-strategy.spec.browser2.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.