Melvynx/saveit.now / .agents/skills/ns-intercepted-route-using-tanstack-start
ns-intercepted-route-using-tanstack-start
VerifiedImplement masked modal routes in NowStack Mobile web-app. Use for TanStack Start route masks, shareable detail URLs, back-to-close, and refresh-to-page behavior.
Intercepted Route Using TanStack Start
Current route shape:
- Public:
/,/privacy,/cgv,/support - User app:
/app - Admin:
/admin(redirects to/admin/users),/admin/users,/admin/users/$userId
The examples below use a hypothetical /admin/items list/detail flow to illustrate the pattern.
- User starts on
/admin/items. - User clicks a row.
- Browser URL becomes
/admin/items/$itemId. - UI keeps the
/admin/itemslist visible and opens a modal/sheet with the detail. - Back or close returns to
/admin/items. - Refresh or direct visit on
/admin/items/$itemIdrenders the full detail page.
<core_pattern> Navigate to the source route internally, store modal state in source route search, and mask the visible URL as the destination route.
<Link
to="/admin/items"
search={{ itemId: item._id }}
mask={{
to: "/admin/items/$itemId",
params: { itemId: item._id },
unmaskOnReload: true,
}}
resetScroll={false}
>
View
</Link>
The source route owns modal state:
type ItemsSearch = {
itemId?: string;
};
export const Route = createFileRoute("/admin/items")({
validateSearch: (search: Record<string, unknown>): ItemsSearch => ({
itemId:
typeof search.itemId === "string" && search.itemId.length > 0
? search.itemId
: undefined,
}),
component: AdminItemsPage,
});
The destination route remains a real route:
export const Route = createFileRoute("/admin/items/$itemId")({
component: AdminItemDetailPage,
});
</core_pattern>
const router = useRouter();
const location = useLocation();
const closeModal = () => {
if (location.maskedLocation) {
router.history.back();
return;
}
void router.navigate({
to: "/admin/items",
search: {},
replace: true,
});
};
If the modal has an "Open full page" action, navigate directly and do not call the close handler first:
void router.navigate({
to: "/admin/items/$itemId",
params: { itemId },
replace: true,
});
cd web-app && npm run typecheck
cd web-app && npm run build
Then verify manually or with browser automation:
- Open source route.
- Click detail link.
- Confirm browser URL is the detail URL.
- Confirm modal/sheet is visible over source context.
- Use Back or close and confirm source route returns.
- Open detail URL directly or refresh and confirm full detail page renders.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 192k | Updated | Claude CodeCodex | Verified | Install |