Skip to content

Keep final-page focus requests within their DOM commit - #1062

Open
zlareb1 wants to merge 4 commits into
mainfrom
fix/last-page-focus-commit
Open

zlareb1 wants to merge 4 commits into
mainfrom
fix/last-page-focus-commit

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Related: #1076

Related: #1059

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Loading the last page keeps keyboard focus on a newly added row when the Load more button disappears.

Why

A pending passive effect can consume a pagination focus request written after its render. When the last page removes Load more, the request has already been cleared and focus stays on the page. Perform the handoff in the layout effect for the commit that owns it.

Scope and risk

Changes the shared final-page focus hook and adds a deterministic regression that starts a read before the previous render's passive effects flush. The hook also serves synchronous Show more controls; the existing intermediate-page, explicit user focus and fallback guards still apply. The risk is focus moving at the wrong commit.

Compatibility, rollout and rollback

  • Wire: no changes.
  • Operator steps: none.
  • Rollback: revert the hook and regression; no stored data changes.

Tests

  • Before the hook change, npm --prefix frontend run test -- src/lib/useLastPageFocus.test.tsx --maxWorkers=1 produced the predicted new failure with focus on the page; all four existing controls passed.
  • The earlier three-file local run was stopped by the process-tree memory guard and remains incomplete.
  • The focused useLastPageFocus.test.tsx suite passes all five cases under the bounded local supervisor on the preceding main composition.
  • Biome checks for both changed files and git diff --check pass.
  • The preceding head failed Cell latency acceptance and integration shard 4. The integration failures came from a replicated-erasure fixture missing its lease table; this branch composes the merged fixture repair. That composition subsequently passed all 53 hosted checks, including Cell acceptance. This branch also composes the current main changes; full frontend tests, build, bundle budget, browser accessibility checks and all remaining required checks must pass on this new composition before merge.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Codex wrote the change and inspected the failing log, effect ordering and regression result. Independent agent review checks the complete diff and related callers.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: none affected.
  • A new migration is additive and numbered after the latest on main; no migration changes.
  • A behaviour change to any file a plugin ships bumps both plugin manifests' version: no plugin changes.
  • The frontend builds and its tests pass.
  • Docs describe the system as it now is, and this description names any operator steps and wire changes: no interface or operator changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers.
  • Commits are signed off.

A pending passive effect can clear a request before its loading state commits. Hand focus over in a layout effect and reproduce the lost request before passive effects flush.

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 21, 2026 1:26am UTC

Request Review

Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant