Skip to content

feat(pages): expose current, active, and pending link status - #924

Open
karthickeyan-dev wants to merge 3 commits into
voidzero-dev:mainfrom
karthickeyan-dev:feat/pages-link-status
Open

karthickeyan-dev wants to merge 3 commits into
voidzero-dev:mainfrom
karthickeyan-dev:feat/pages-link-status

Conversation

@karthickeyan-dev

Copy link
Copy Markdown
Contributor

Closes #803.

A sidebar button can now read the state of its destination, and a link can show a spinner while its own destination loads. All four Pages adapters expose useLinkStatus(href, { method, data, activeMatch }) and pass the same { current, active, pending } to link children through a render prop, scoped slot, or snippet. For breadcrumbs and menus, isLinkActive and isLinkPending from void/pages-client can run inside a loop.

Design

Void already distinguishes the current page from an active parent section, and matches pending visits by method, path, full query, and hash. The hook, children, and automatic DOM attributes now use one implementation of those rules. Existing links can keep ordinary children and override the rendered attributes.

Verification

The shared matching tests cover query data, prefix boundaries, methods, hashes, and pending visits. Browser coverage across React, Vue, Svelte, and Solid holds a POST request open, checks that its link label and surrounding component update together, and verifies that both return to idle.

karthickeyan-dev and others added 3 commits November 26, 2026 11:09
Solid and Svelte link status derivations returned a fresh object on every
navigation or URL change, re-running effects and render-prop children even
when current, active, and pending stayed the same. Compare Solid memos by
value with a shared linkStatusEquals helper, and derive each Svelte field
separately.

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

Vue's computed and React's useMemo returned a fresh LinkStatus object on
every navigation, so watchers, Link renders, memoized children, and effect
dependencies reran even when current, active, and pending stayed the same.
Reuse the previous object for an equal status in both adapters, and cover
unchanged-status notifications for Vue, React, and Svelte plus null-router
cases for isLinkActive and isLinkPending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@karthickeyan-dev
karthickeyan-dev marked this pull request as ready for review November 26, 2026 06:12

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.

Expose a link's active and pending state as values, not only DOM attributes

1 participant