Skip to content

Commit b4a76ca

Browse files
authored
fix(marko-virtual): consolidate Marko e2e into one in-package app, fix test (#1243)
1 parent 1323692 commit b4a76ca

151 files changed

Lines changed: 816 additions & 2555 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@tanstack/marko-virtual': patch
3+
---
4+
5+
Stop publishing the tags build's incremental state: `marko-type-check` writes
6+
`dist/tsconfig.tags.tsbuildinfo`, which the `files` field shipped to npm and nx
7+
cached as part of `dist`. Because `@marko/type-check` always runs incrementally, a
8+
`dist` that carried that file but not `dist/tags` (which `marko.json` points at)
9+
made every subsequent build a silent no-op — exit 0, nothing emitted — and any
10+
consumer then failed to compile with
11+
`ENOENT: no such file or directory, scandir '.../dist/tags'`. The build now removes
12+
the file after emitting, so a build always produces `dist/tags`.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@ vite.config.ts.timestamp-*
4646
test-results/
4747
playwright-report/
4848
*.log
49-
**/*.tsbuildinfo
49+
**/*.tsbuildinfo
50+
51+
# Marko Run generated route types
52+
.marko-run/

examples/marko/chat-pretext/.marko-run/routes.d.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

examples/marko/chat-pretext/e2e/README.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/marko/chat-pretext/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dev": "marko-run dev",
77
"build": "marko-run build",
88
"preview": "marko-run preview",
9-
"test:e2e": "playwright test",
109
"test:types": "marko-type-check"
1110
},
1211
"dependencies": {
@@ -18,7 +17,6 @@
1817
"devDependencies": {
1918
"@marko/language-tools": "^2.6.2",
2019
"@marko/type-check": "3.1.1",
21-
"@playwright/test": "^1.53.1",
2220
"typescript": "5.9.3",
2321
"vite": "^6.4.2"
2422
}

examples/marko/chat-pretext/playwright.config.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/marko/chat-pretext/src/routes/+page.marko

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ static function messageHeight(message: Message, viewportWidth: number) {
133133
pinnedInitially: false,
134134
autoHistoryArmed: false,
135135
autoHistoryEnabled: false,
136+
// "Latest" in flight: keep re-pinning until the end is actually reached. A
137+
// single scrollToEnd() can land and then be carried away — e.g. an in-flight
138+
// history prepend (180ms timer) resolving AFTER the jump grows the content
139+
// above the viewport, and if core's offset read is stale at that moment its
140+
// at-end compensation is skipped — so the view strands ~12 rows short with no
141+
// scroll event to recover it. The reactive <script> below re-issues the jump
142+
// on every virtualizer update until the end holds, then disarms.
143+
pinPending: false,
136144
streamAbort: null as AbortController | null,
137145
width: DEFAULT_VIEWPORT_WIDTH,
138146
})/>
@@ -167,6 +175,7 @@ static function messageHeight(message: Message, viewportWidth: number) {
167175
// the initial settle. Same pattern as the Chat example.
168176
<script() {
169177
if (!state.pinnedInitially && v.range) {
178+
state.pinPending = true
170179
v.scrollToEnd()
171180
atEnd = true
172181
state.pinnedInitially = true
@@ -183,6 +192,18 @@ static function messageHeight(message: Message, viewportWidth: number) {
183192
if (statusEl) {
184193
atEnd = statusEl.scrollHeight - statusEl.scrollTop - statusEl.clientHeight <= AT_END_PX
185194
}
195+
// Converge an in-flight "Latest": re-issue the jump while content growth keeps
196+
// moving the end away (see pinPending above). Disarms once the end holds AND no
197+
// history load is in flight — a prepend armed before the click can land after
198+
// the end was first reached, and disarming early would leave that late growth
199+
// with no corrective jump.
200+
if (state.pinPending) {
201+
if (atEnd && !loadingHistory) {
202+
state.pinPending = false
203+
} else if (!atEnd) {
204+
v.scrollToEnd()
205+
}
206+
}
186207
}/>
187208

188209
<div class="toolbar">
@@ -238,7 +259,10 @@ static function messageHeight(message: Message, viewportWidth: number) {
238259
}
239260
})()
240261
}>Stream reply</button>
241-
<button data-testid="latest" onClick() { v.scrollToEnd() }>Latest</button>
262+
<button data-testid="latest" onClick() {
263+
state.pinPending = true
264+
v.scrollToEnd()
265+
}>Latest</button>
242266
</div>
243267
<div class="status" data-testid="status">
244268
${loadingHistory ? 'Loading history' : atEnd ? 'At latest' : 'Reading history'}

examples/marko/chat-pretext/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
},
1414
"include": [
1515
"src",
16-
"e2e",
17-
"playwright.config.ts",
1816
"vite.config.ts",
1917
"../../../packages/marko-virtual/src/tags/**/*"
2018
]

examples/marko/chat/.marko-run/routes.d.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

examples/marko/chat/e2e/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)