You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cc5d11e
Browse filesBrowse the repository at this point in the historyBrowse files
Honor initialTopMostItemIndex and scrollToIndex inside VirtuosoMockContext (#1553)
* fix: honor initialTopMostItemIndex inside VirtuosoMockContext
The scroller drops scrollTo requests when the scroll element has no
layout (offsetHeight 0), which is always the case in jsdom. With
initialTopMostItemIndex set, the list waits for the scroll to land
before rendering items, so it stayed empty. Under VirtuosoMockContext
the scroller now reports the requested position as the new scroll
container state.
Fixes#1001
* Keep mock scrollTo from re-rendering the scroller and cover more scroll paths
The mock scrollTo handler read totalListHeight through useEmitterValue, which
made the Scroller re-render on every list height change in production too,
where the mock path is never used. Read it through a ref fed by useEmitter
instead.
Add tests for clamping near the end, align: 'end', imperative and smooth
scrollToIndex, GroupedVirtuoso and TableVirtuoso under VirtuosoMockContext.
* Regenerate skill references for the item remount troubleshooting docs
The troubleshooting section added in #1540 was not propagated to the generated
skill references, so the Validate Skills drift check failed.
---------
Co-authored-by: HawkForge <[email protected]>
Fixed `initialTopMostItemIndex` and `scrollToIndex` having no effect inside `VirtuosoMockContext`. The scroller now reports the requested scroll position directly, so the list renders the target items in tests instead of staying empty or starting from the first item.
Copy file name to clipboardExpand all lines: packages/virtuoso-skills/skills/react-virtuoso/references/6.troubleshooting.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,38 @@ function App() {
122
122
123
123
See the [custom rendering documentation](/customize-rendering) for more details on component customization patterns.
124
124
125
+
## Items change height when they scroll back into view
126
+
127
+
Unlike the inline component case above, some remounts are expected. The list unmounts items that leave the rendered area and mounts them again when they come back. A remounted item is a new component instance, so its local state starts over. If that state affects the item's height, the new measurement differs from the size the list remembered, and the layout shifts.
128
+
129
+
### Why this happens
130
+
131
+
These patterns change an item's height on every mount:
132
+
133
+
- An entry animation that animates `height` or `max-height` replays each time the item mounts.
134
+
- An image without a fixed size takes little or no space until it loads, then grows.
135
+
- Content that appears after a delay, such as action buttons, is hidden again until the delay passes.
136
+
137
+
### Fix
138
+
139
+
Make the item render at its final height on every mount:
140
+
141
+
- Reserve space for images and other async content with explicit `width`/`height` or `aspect-ratio`.
142
+
- Animate entries with `transform` and `opacity` only, so the animation doesn't change the layout.
143
+
- Keep state that should apply only once, such as "the entry animation has played", outside the item component and key it by the item id, so it survives remounts:
## Webpack dev server shows an error `Uncaught Error: ResizeObserver loop completed with undelivered notifications`
126
158
127
159
This is a known issue with the Webpack dev server and the `ResizeObserver` API used by Virtuoso. To silence this error, apply the following configuration to your server:
Copy file name to clipboardExpand all lines: plugins/virtuoso-skills/skills/react-virtuoso/references/6.troubleshooting.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,38 @@ function App() {
122
122
123
123
See the [custom rendering documentation](/customize-rendering) for more details on component customization patterns.
124
124
125
+
## Items change height when they scroll back into view
126
+
127
+
Unlike the inline component case above, some remounts are expected. The list unmounts items that leave the rendered area and mounts them again when they come back. A remounted item is a new component instance, so its local state starts over. If that state affects the item's height, the new measurement differs from the size the list remembered, and the layout shifts.
128
+
129
+
### Why this happens
130
+
131
+
These patterns change an item's height on every mount:
132
+
133
+
- An entry animation that animates `height` or `max-height` replays each time the item mounts.
134
+
- An image without a fixed size takes little or no space until it loads, then grows.
135
+
- Content that appears after a delay, such as action buttons, is hidden again until the delay passes.
136
+
137
+
### Fix
138
+
139
+
Make the item render at its final height on every mount:
140
+
141
+
- Reserve space for images and other async content with explicit `width`/`height` or `aspect-ratio`.
142
+
- Animate entries with `transform` and `opacity` only, so the animation doesn't change the layout.
143
+
- Keep state that should apply only once, such as "the entry animation has played", outside the item component and key it by the item id, so it survives remounts:
## Webpack dev server shows an error `Uncaught Error: ResizeObserver loop completed with undelivered notifications`
126
158
127
159
This is a known issue with the Webpack dev server and the `ResizeObserver` API used by Virtuoso. To silence this error, apply the following configuration to your server:
Copy file name to clipboardExpand all lines: skills/react-virtuoso/references/6.troubleshooting.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,38 @@ function App() {
122
122
123
123
See the [custom rendering documentation](/customize-rendering) for more details on component customization patterns.
124
124
125
+
## Items change height when they scroll back into view
126
+
127
+
Unlike the inline component case above, some remounts are expected. The list unmounts items that leave the rendered area and mounts them again when they come back. A remounted item is a new component instance, so its local state starts over. If that state affects the item's height, the new measurement differs from the size the list remembered, and the layout shifts.
128
+
129
+
### Why this happens
130
+
131
+
These patterns change an item's height on every mount:
132
+
133
+
- An entry animation that animates `height` or `max-height` replays each time the item mounts.
134
+
- An image without a fixed size takes little or no space until it loads, then grows.
135
+
- Content that appears after a delay, such as action buttons, is hidden again until the delay passes.
136
+
137
+
### Fix
138
+
139
+
Make the item render at its final height on every mount:
140
+
141
+
- Reserve space for images and other async content with explicit `width`/`height` or `aspect-ratio`.
142
+
- Animate entries with `transform` and `opacity` only, so the animation doesn't change the layout.
143
+
- Keep state that should apply only once, such as "the entry animation has played", outside the item component and key it by the item id, so it survives remounts:
## Webpack dev server shows an error `Uncaught Error: ResizeObserver loop completed with undelivered notifications`
126
158
127
159
This is a known issue with the Webpack dev server and the `ResizeObserver` API used by Virtuoso. To silence this error, apply the following configuration to your server:
0 commit comments