Skip to content
Source
Sign inSign up
TanStack/virtual

fix(marko-virtual): retry a prepend's anchor write clamped before the sizer commits #1359

Openofficialasishkumar(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/1359/headopened

Showing 7 changed files with 78 additions and 11 deletions (loading 4).

x
0 of 7 viewed, 7 left
6 additions and 0 deletions.changeset/marko-prepend-anchor-retry.mdAdded
View file
@@ -0,0 +1,6 @@
+---
+'@tanstack/virtual-core': patch
+'@tanstack/marko-virtual': patch
+---
+​
+Keep an end-anchored Marko list at the bottom when a prepend lands right after `scrollToEnd()`. The prepend's anchor write is made before Marko commits the grown sizer, so the browser clamped it to the old end; core now records that clamp and the Marko tags retry the write once the new total size is rendered.
36 additions and 5 deletionspackages/marko-virtual/e2e/app/e2e/chat-pretext.spec.tsModified
View file
@@ -193,11 +193,7 @@
.toBeGreaterThan(heightBefore)
​
-// FIXME(#1267): deterministic on CI. The click lands before the 180ms auto history
-// load fires, the prepend then resolves after the jump, and the adapter's anchor
-// write is clamped against the not-yet-grown sizer — the view strands one prepend
-// (~870px) above the bottom. Re-enable once #1267 is fixed.
-test.fixme('Latest returns to the bottom and status flips back to At latest', async ({
+test('Latest returns to the bottom and status flips back to At latest', async ({
page,
}) => {
await page.goto('/chat-pretext')
@@ -214,6 +210,41 @@
await expect(page.locator('[data-key^="message-4"]').last()).toBeVisible()
​
+// #1267: Latest clicked while a history load is in flight, so the prepend lands
+// after the jump. Its anchor write is made before Marko commits the grown sizer and
+// is clamped to the old max; unless it is retried once the sizer has grown, the view