Skip to content

Make each tool on /tools linkable via ?tool= - #762

Merged
zksquirrel merged 1 commit into
ZecHub:mainfrom
shadowosx:tools-url-state
Aug 30, 2026
Merged

Make each tool on /tools linkable via ?tool=#762
zksquirrel merged 1 commit into
ZecHub:mainfrom
shadowosx:tools-url-state

Conversation

@shadowosx

@shadowosx shadowosx commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Right now the open tool lives in React state, so you cannot link to one. Sharing the Address Decoder means telling someone to open /tools and click the fourth tab, a refresh drops them back on the converter, and Back does not undo a tab switch.

The query string is the source of truth now:

/tools?tool=converter
/tools?tool=payment-request
/tools?tool=payment-request-widget
/tools?tool=address-decoder

Missing or unknown values fall back to the converter, as today.

Two things to look at in the diff:

Tab ids are the slugs, so payment became payment-request and decoder became address-decoder. Internal before, public URLs from here.

/tools is force-dynamic. Prerendered it has no query string to read, so a shared link would render the converter and only swap after hydration. There is no data fetching on the page, so it is only the render. Tab clicks still use history.pushState rather than the router, so switching stays instant and Back/Forward still get real history entries.

e2e/tools-url.spec.ts covers deep links, an unknown slug, refresh, Back/Forward through three tabs, and /es/tools keeping its prefix. Six tests, all green against yarn build && yarn start. It reads TOOLS_BASE_URL the way egress.spec.ts reads EGRESS_BASE_URL.

Also walked it by hand in the browser in English and Spanish, including that clicking the tab you are already on does not pile up history entries.

The selected tool lived in React state, so it could not be linked to, a
refresh dropped you back on the converter, and Back did not undo a tab
switch. The query string is the source of truth now.

Tab ids double as the slug, so `payment` is `payment-request` and
`decoder` is `address-decoder`. The page renders per request so a shared
link serves the right tool instead of swapping to it after hydration.
@zksquirrel
zksquirrel merged commit 8b33a76 into ZecHub:main Aug 30, 2026
3 of 4 checks passed
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