Skip to content

feat(views): find in page reaches every row of the logs stream - #2568

Merged
Makisuo merged 3 commits into
mainfrom
t3/adopt-isdk-list-behaviors
Nov 13, 2026
Merged

Makisuo merged 3 commits into
mainfrom
t3/adopt-isdk-list-behaviors

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What

The logs stream is virtualized: only the ~35 rows on screen exist in the DOM, so the browser's find in page (Cmd+F) missed almost every log. A search for a request id in a 2,000-row stream said "0 results" while the row was in the list.

Now every row is findable:

  • Each row outside the rendered window gets a stand-in holding its text (hidden="until-found"). Stand-ins for rows above the window go in a layer before the rendered rows, rows below go after them, so the browser counts and steps through matches in list order.
  • On a match the browser fires beforematch on the stand-in. The Mount moves the stand-in to its row's virtual offset, so the browser's own scroll-into-view lands on the row and the virtualizer renders it. The found row takes the keyboard focus, so it is marked and j/k carry on from it.
  • Stand-ins are grouped in 64-row chunks (each group also hidden="until-found", so the browser skips style and layout until one matches) and memoized with createKeyedLazy: a window move rebuilds only the chunks at its edges. A stand-in is one element and one text node.
  • The row text is what the row shows (severity, service, pinned values, the message line or the body when wrapping), not timestamps.

The mechanism lives in packages/views/src/lib/findable.ts (findableLayers for the view, bindFindable for the virtualizer Mount, foundAfterWindow for the model) so the traces list and the waterfall can adopt it next.

Known tradeoff (same as the approach this follows): while the found row is on screen its stand-in stays, because the browser's active match lives in it. The count reads one higher until the row scrolls away, and the next match after it skips rows already on screen.

Evidence

/lab/bench/logs (2,000 wide rows), production builds of main and this branch, headless Chromium.

Find reach

main this PR
Rows the browser's find can reach 35 2,000
Matches for Synthetic wide log row 1 (true count 1,111) 11 1,111
Text-fragment match on row 1500 (#:~:text=, the same beforematch reveal as Cmd+F) nothing happens row 1500 scrolled on screen and focused
main: match on row 1500 this PR: match on row 1500

Cost (median of 5 runs, 4x CPU throttle; the scroll is the lab harness's 121-step scroll through the whole list)

Metric main this PR
Time to first rows 1,602 ms 1,690 ms
DOM elements / text nodes 2,896 / 503 4,895 / 2,468
JS heap 56.8 MB 59.5 MB
Load script / layout / style 1,012 / 56 / 40 ms 1,049 / 54 / 40 ms
Scroll frame p95 50 ms 50 ms
Scroll long tasks / TBT 2 / 7 ms 2 / 7 ms
Scroll script / layout / style 1,885 / 394 / 988 ms 2,057 / 415 / 965 ms

About two DOM nodes per row, and about 9% more script while scrolling (rows crossing the window edge move their stand-in between layers; chunk sizes of 16, 32 and 64 measured within 2% of each other). Frame p95 and blocking time are unchanged.

Tests

  • New scene tests: stand-ins on both sides, hidden until found, none for rendered rows; a match focuses the row and keeps its stand-in revealed while the row is on screen, including through a stale window; the stand-in hides again once the row scrolls away.
  • vitest run src/ui/logs (21 passed), typecheck for packages/views and apps/web, oxlint -c .oxlintrc.effect.json clean on the changed files.

Not yet verified: the live Cmd+F find bar (Enter stepping, the count it shows). It can't be driven headless; it will be checked on the preview.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…d logs stream

Rows outside the virtual window get hidden=until-found stand-ins in layers
before and after the window. On a match the browser fires beforematch; the
stand-in moves to its row's offset so the browser's own scroll lands there,
and the found row takes the keyboard focus.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97898d6d-cc87-46c7-98e7-41d0a85d7db8
Commits

Reviewing files that changed from the base of the PR and between b4fd88f and bca8825.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 8

  • packages/views/package.json
  • packages/views/src/lib/findable.test.ts
  • packages/views/src/lib/findable.ts
  • packages/views/src/ui/logs/logs-stream-message.ts
  • packages/views/src/ui/logs/logs-stream-view.ts
  • packages/views/src/ui/logs/logs-stream.scene.test.ts
  • packages/views/src/ui/logs/logs-stream.ts
  • packages/views/src/ui/logs/virtualize.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@maple-review-bot

This comment has been minimized.

@Makisuo Makisuo added the preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md label Nov 13, 2026
@Makisuo
Makisuo deployed to preview-tinybird November 13, 2026 15:17 — with GitHub Actions Active

@maple-review-bot maple-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 inline note from Maple's review. The score and summary are in the review comment above.

Comment thread packages/views/src/lib/findable.ts Resolved
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🍁 Maple PR preview

Note

Preview resources were removed when this pull request closed.

Final commit bca8825 · View workflow run

@Makisuo
Makisuo deployed to pr-preview November 13, 2026 15:30 — with GitHub Actions Active
@Makisuo
Makisuo deployed to preview-tinybird November 13, 2026 15:30 — with GitHub Actions Active
@maple-review-bot

maple-review-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. The change since the last review adds a happy-dom test of the beforematch handler plus its devDependency; the assertions track bindFindable and TanStack's start - scrollMargin offset exactly.
no findings · tests covered · risk low

The delta since the last review is packages/views/src/lib/findable.test.ts, happy-dom in that package's devDependencies, and the lockfile. The test drives bindFindable over a real @tanstack/virtual-core virtualizer and covers the handler the earlier review flagged as untested; nothing needs changing.

  • findable.test.ts fires bubbling beforematch on a stand-in and its group through bindFindable
  • happy-dom added as a @maple/views devDependency, same ^21.0.4 as apps/landing
  • Docblock @vitest-environment happy-dom overrides the package's node default for this file

bca8825 · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@Makisuo
Makisuo deployed to pr-preview November 13, 2026 15:34 — with GitHub Actions Active
@Makisuo

Makisuo commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator Author

Preview check (app-pr-2568.maple.dev, /logs, Last 7 days)

Run by a separate agent with headless Chromium. Signed in as the preview reviewer. The preview org only has 14 logs, so all 14 rows fit on a 900px-tall screen and none get a stand-in. Every check ran at 1440x500 with wrap on, which gives 9 rendered rows and 5 stand-ins.

Check Result
Rendered rows + stand-ins = loaded rows ✅ 9 rendered + 5 after = 14 (footer "14 logs")
A text-fragment match on row 12, below the window (a fresh load with #:~:text=, the same hidden="until-found" + beforematch reveal Cmd+F uses) ✅ the browser scrolled, row 12 rendered fully inside the scroller with data-focused="true", and its stand-in and group were un-hidden
Scroll back to top ✅ row 12's stand-in and group are hidden="until-found" again, 9 + 5 = 14
The before layer ✅ scrolled to the bottom: rows 5–13 rendered, stand-ins for 0–4
j/k after a find ✅ 12 → 11 → 10 → 11
Density and wrap toggles ✅ every state totals 14 (wrap off renders all 14 with no stand-ins)
Reload ✅ 9 + 5 = 14 after the refetch
Console errors / page errors ✅ 0 during the whole run
Row 12 found and focused Scrolled away, stand-in hidden again

Video of the run: preview-run.webm

Not covered here:

  • The live Cmd+F find bar (pressing Enter to step through matches, and the count it shows). Chromium has no automation hook for it.
  • A real match on a row above the window. A text fragment only fires on a fresh load, and a fresh load always starts at the top. The before side is covered by the scene tests.

The 64-row grouping is covered by the 2,000-row lab benchmark in the PR description.

Traces: the change is client-only DOM work on a hot scroll path. It makes no requests and calls no backend code, so it has no spans and nothing to trace.

@Makisuo
Makisuo merged commit c7231d7 into main Nov 13, 2026
43 of 45 checks passed
@Makisuo
Makisuo deleted the t3/adopt-isdk-list-behaviors branch November 13, 2026 16:24
@Makisuo
Makisuo deployed to pr-preview November 13, 2026 16:24 — with GitHub Actions Active
@Makisuo
Makisuo deployed to preview-tinybird November 13, 2026 16:24 — with GitHub Actions Active

This branch was successfully deployed

2 active deployments
pr-preview — bca8825b Deployed Nov 13, 2026 by Makisuo via deploy-pr-preview #11892
preview-tinybird — bca8825b Deployed Nov 13, 2026 by Makisuo via branch #1470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview:web Deploy a Workers-only PR preview (no ingest/Electric); see docs/pr-previews.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant