Repository navigation
fix(virtual-core): apply initialMeasurementsCache only once - #1391
Conversation
getMeasurements re-seeded itemSizeCache from initialMeasurementsCache whenever measurementsCache was empty, which also happens after count drops to 0. Refilling the list then put the snapshot's sizes back over the sizes measured since mount. Seed it once; enabled: false still resets it along with the measured sizes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🦋 Changeset detectedLatest commit: 8d36be8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
View your CI Pipeline Execution ↗ for commit 8d36be8
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🎯 Changes
initialMeasurementsCacheis documented as "consumed only once, on the firstgetMeasurements()call after mount", but it is applied again every time the list becomes empty. Whencountgoes to 0 and back (a search with no matches, a loading state during a refetch), the snapshot's sizes overwrite the sizes rows were measured at since mount.Off-screen rows keep the stale sizes, so
getTotalSize(), the scrollbar andscrollToIndextargets are off until those rows render again, and visible rows jump when the ResizeObserver corrects them.getMeasurements()seeds from the snapshot whenevermeasurementsCache.length === 0, which is also true after any build withcount === 0. A private flag now makes the seeding happen once.enabled: falsealready clears the measured sizes and also resets the flag, so togglingenabledkeeps today's behavior.Added a test that empties and refills a list restored from a snapshot; it fails without the fix.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit