-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify elements-to-rerender calculation between the real and fake disp…
…atch (#6465) ## Problem The real dispatch in `editor.tsx` and the fake dispatch have a different way of calculating which elements to sample with the DOM sampler. This has been OK up until now, since often all elements we re-rendered/re-sampled, but now that we started to get more selective with what to re-render/re-sample, this discrepancy caused problems in an upcoming PR, #6450. The problem in #6450 is that in order for the group true-ups to work with resizing, the absolute resize strategy would have to explicitly declare any group children of the resized elements as elements to re-render. Individual strategies shouldn't be aware of this, since automatically resizing groups is a feature provided by the "platform" code. However, it's not enough to put the code to find the child groups into `boundDispatch`, since then the same thing would have to be re-implemented in the fake dispatch, so we need to find a way to share this logic between the two dispatches. ## Fix This PR contains the dispatch-related portion of the problem discovered in #6450. The concrete fix is to extract out the logic to determine which elements to re-render/re-sample into a function that's used by both the real and fake dispatch. This logic contains which child groups to re-render as well. ### Note on `ElementsToRerenderGLOBAL.current` The real dispatch updates `ElementsToRerenderGLOBAL.current`, while the fake one doesn't. Ideally this behaviour would be the same too, but updating `ElementsToRerenderGLOBAL.current` inside `collectElementsToRerender` led to test failures that didn't happen on the PR where this problem was discovered, so this is out of scope for this PR
- Loading branch information
Showing
2 changed files
with
53 additions
and
30 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