Skip to content

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

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

karthickeyan-dev wants to merge 5 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
karthickeyan-dev marked this pull request as ready for review November 26, 2026 06:12
@karthickeyan-dev
karthickeyan-dev deleted the feat/pages-link-status branch November 30, 2026 04:17
@karthickeyan-dev
karthickeyan-dev restored the feat/pages-link-status branch December 1, 2026 01:32
@Brooooooklyn
Brooooooklyn self-requested a review December 1, 2026 08:37
karthickeyan-dev and others added 5 commits December 1, 2026 16:38
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>
…changes

Solid passes <Show>, <For> and lazy components to Link as zero-argument
accessors. Link called every function child with the status inside the
insert effect, so each current/active/pending change rebuilt that subtree.
Only call a child that takes an argument, as <Show> does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Restore the active and pending rule comments on the matchers.
- Rename resolvedLinkStatus to getResolvedLinkStatus and drop the
  duplicate pending check.
- Re-export isLinkActive and isLinkPending from each adapter, and
  LinkProps from @void/react.
- Show useLinkStatus in all four adapters, list it in the runtime API
  table, and note where to call the plain functions.
- Type-check the Vue Link status slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn force-pushed the feat/pages-link-status branch from 223e4c3 to 35804b9 Compare December 1, 2026 09:00
@Brooooooklyn

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T09:06:25.269325Z 35804b9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 35804b9b63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

2 participants