Skip to content

feat(pages): mark Links to the page that is loading - #698

Merged
cpojer merged 2 commits into
voidzero-dev:mainfrom
yangshun:feat/link-pending-attribute
Nov 4, 2026
Merged

cpojer merged 2 commits into
voidzero-dev:mainfrom
yangshun:feat/link-pending-attribute

Conversation

@yangshun

@yangshun yangshun commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Link now adds data-void-pending while a visit to its destination loads, so a slow navigation shows feedback on the link itself.

  • A link is pending when the visit's path, query, hash and method all match its own. Unlike data-void-active, the query counts.
  • Every link to the destination is marked, not just the clicked one.
  • Non-GET Links, which render a <button>, are pending while their own request runs.

Worth knowing

  • router.refresh() marks links to the current page while it runs.
  • A prefetched page can show the attribute for a moment. The guide's CSS example adds a transition delay to hide this.
  • React Links now re-render when a visit starts and ends.

Tests: the browser contract passes for all four adapters in dev and preview, along with vp run check and the full vp run test. The one failure in the full run, a WebSocket playground timeout under load, passes when run alone.

🤖 Generated with Claude Code

yangshun and others added 2 commits November 4, 2026 13:14
Link adds `data-void-pending` while a visit to its destination loads, in
React, Vue, Svelte and Solid, so a slow navigation shows feedback on the
link without comparing `useNavigation().location` with each href by hand.

A link is pending when the in-flight visit uses its method and goes to its
path, query and hash. Non-GET Links, which render a <button>, are pending
while their own request runs. `linkPendingAttributes()` in
`void/pages-client` does the matching so the adapters can't drift, and the
URL resolution it shares with `linkActiveAttributes()` moves into one
helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ribute

# Conflicts:
#	docs/reference/api/pages.md

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice.

@cpojer
cpojer merged commit c42173e into voidzero-dev:main Nov 4, 2026
18 checks passed
@yangshun
yangshun deleted the feat/link-pending-attribute branch November 4, 2026 12:21
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.

2 participants