-
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.
Run dom walker after resize/mutation observer changes in select mode (#…
…5838) **Problem:** In the sample store we encountered out-of-date navigator several times, e.g. after initial load or after remix navigation. Sometimes the problem is automatically fixed after a while, sometimes you need to interact with the editor, and then the navigator is fixed. See: #5824 **Fix:** When you navigate with Remix, or you wait for asynchronous load of data and for the changes after that, then there is no final dispatch when the content is ready (which would trigger a dom walker run). We experienced this problem earlier in live mode: when the state of the app changes in live mode, we need to guarantee to run the dom walker, even though no dispatch has happened. To fix this, we rely in resize and mutation observers, see, #4167 Even though In the original PR the observers were not turned in select mode due to performance reasons, in my experience the performance impact is acceptable, because we don't listen to the observer during canvas interactions. So we only have extra dom walker runs after one-off interactions, e.g. after changing something in the inspector. I stopped using the resize observer polyfill, because ResizeObserver is widely supported on modern browsers, so that just looked as a potential source of problems (and the native solution should be better regarding performance too). I still needed to keep the polyfill for unit tests, because jsdom doesn't support ResizeObserver. I disabled the dom walker caching tests, because they were already invalid (they expected exactly the opposite what their title described....). Fully understanding why these tests are like this and fix them would greatly increase the scope of this PR, and it is an urgent fix for a project like the sample store. **Manual Tests:** I hereby swear that: - [X] I opened a hydrogen project and it loaded - [X] I could navigate to various routes in Preview mode Fixes #5824
- Loading branch information
Showing
6 changed files
with
141 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
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.