Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More shouldUpdate optimizations (#6075)
**Problem:** Follow-up to #6070 **Fix:** I introduced two more optimizations: 1. The bigger one is that shouldUpdate called `isElementInChildrenOrPropsTree` separately for each of the element paths in `ElementsToRerenderGLOBAL`, even though all these runs traversed the same subtree, because they were called with the same `props` parameter. I updated `isElementInChildrenOrPropsTree` to work on an array of element paths, and check for all of them in a single execution of the function. I was a bit worried that the added complexity of this function may slow down the most typical single element use case, but I did not find the effect measurable. This really heavily speeds up multiselection interactions, basically a multiselection with n elements is nearly n times faster with this code. 3. I added an early return to not do anything at all when the props.children is null or a string (happens frequently). **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
- Loading branch information