Skip to content

feat(sparkling-history): reusable web-history shim for native MPA navigation - #14

Open
Huxpro wants to merge 1 commit into
mainfrom
claude/tsr-01-sparkling-history
Open

feat(sparkling-history): reusable web-history shim for native MPA navigation#14
Huxpro wants to merge 1 commit into
mainfrom
claude/tsr-01-sparkling-history

Conversation

@Huxpro

@Huxpro Huxpro commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked PR 1/5. Introduces sparkling-history — a router-agnostic navigation shim that lets any web-history-driven router drive Sparkling's native multi-page (MPA) navigation. This is the reusable foundation; the TanStack Router port sits on top of it in later PRs.

It has no runtime dependency on any specific router@tanstack/react-router appears only as a test devDependency, to prove the contract against a real router.

📚 Stack (review bottom → top)

  1. 👉 tsr-01-sparkling-history — router-agnostic web-history shim (this PR)
  2. tsr-02-reactlynx-spike — prove TanStack Router runs on ReactLynx
  3. tsr-03-mpa-codegen — file-based routing + native MPA + codegen
  4. tsr-04-website-goweb — go-web example + in-card web bridge
  5. tsr-05-docs-guide — design guide + support matrix + RN comparison

Related issues

Standalone (part of the TanStack-Router-on-Sparkling effort). Supersedes the combined branch in #1.

Changes

  • NavigationHost contract (types.ts): the minimal open/close/stack-depth surface a native container must provide.
  • createMpaHistory: an in-memory entry stack for in-page routes plus page-boundary semantics — cross-page hrefs forward to host.open, back below the local root forwards to host.close. Mirrors @tanstack/history's memory history for the in-page subset; blockers run in any JS environment (no document gate).
  • createSparklingHost: binds the contract to sparkling-navigation — builds the hybrid:// scheme (bundle + __mpa_href/depth/state transport) and reconstructs a destination page's initial location from its launch queryItems. The native container's own push/pop transition is opted in via the animated flag.
  • createMemoryHost: a recording test double.
  • resolve-page / parse-href helpers.
  • Unit tests (in-page, mpa, sparkling-host) covering the in-page subset and the cross-page/native behaviors.

How to test

pnpm --filter sparkling-history test   # 29 passing

Checklist

  • I ran relevant checks (pnpm --filter sparkling-history test → 29 passing)
  • I added/updated tests
  • Docs — the design guide lands in PR 5/5 of the stack

🤖 Generated with Claude Code

https://claude.ai/code/session_01H1EU55YA4e1zj2oVHh7Zme


Generated by Claude Code

…igation

A router-agnostic navigation shim that lets any web-history-driven router drive
Sparkling's native multi-page navigation. It has no dependency on any specific
router — @tanstack/react-router appears only as a test devDependency to prove
the contract against a real router.

- NavigationHost contract (types.ts): the minimal open/close/stack-depth surface
  a native container must provide.
- createMpaHistory: an in-memory entry stack for in-page routes plus page-
  boundary semantics — cross-page hrefs forward to host.open, back below the
  local root forwards to host.close. Mirrors @tanstack/history's memory history
  for the in-page subset, with blockers evaluated in any JS environment.
- createSparklingHost: binds the contract to sparkling-navigation — builds the
  hybrid:// scheme (bundle + __mpa_href/depth/state transport) and reconstructs
  a destination page's initial location from its launch queryItems. The native
  container's own push/pop transition is opted in via the `animated` flag.
- createMemoryHost: a recording test double.
- resolve-page / parse-href helpers.
- Unit tests (in-page, mpa, sparkling-host) covering the in-page subset and the
  cross-page/native behaviors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1EU55YA4e1zj2oVHh7Zme
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sparkling Ready Ready Preview, Comment Jul 13, 2026 1:30pm

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