Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Nov 28, 2025

Summary

Adds URL-based routing to preserve the sidebar and nested tab navigation state. I've got very annoyed by losing the navigation state on every page refresh.

CleanShot.2025-11-28.at.20.05.11.mp4

There's one downside – if you copy the current URL from the address bar and share it with someone, they'll see the sidebar and squished Playground instead of a full-page Playground. This is not good or bad, but it's different than it was before and may surprise some folks. I wonder if we should use a localized route param name, e.g. ?xIya-route=details, to prevent opening the sidebar when that URL is opened on another machine.

Implementatino details

The ?route query param is handled via replaceState, thus opening and closing the sidebar multiple times won't pollute the history. Our redux store stores the current route and sidebar state.

Route parameter format:

  • ?route=closed or no param → Sidebar closed (full Playground view)
  • ?route=details → Sidebar open, site-details section, Settings tab
  • ?route=details.files → Sidebar open, site-details section, Files tab
  • ?route=details.blueprint → Sidebar open, Blueprint tab
  • ?route=details.database → Sidebar open, Database tab
  • ?route=details.logs → Sidebar open, Logs tab
  • ?route=blueprints → Sidebar open, Blueprints Gallery section
  • ?route=sidebar → Sidebar open, sidebar list section

Test plan

  • Open sidebar, switch tabs, refresh page → tab state preserved
  • Navigate to ?route=details.files, refresh → Files tab is selected
  • Navigate to ?route=blueprints, refresh → Blueprints Gallery is shown
  • Go from the Temporary Playground to a saved Playgroud -> The viewport should load the saved Playground. Go back to the temporary Playground – the viewport should immediately display the temporary Playground you've just used without any waiting or progress bars.
  • Click a site in sidebar → resets to Settings tab
  • E2E tests pass: npx playwright test -g "Route persistence"

Adds URL-based persistence for sidebar and tab state so users can bookmark
or refresh without losing their place in the UI. The ?route parameter encodes:
- Sidebar open/closed state
- Active section (site-details, blueprints, sidebar list)
- Active tab in site details (settings, files, blueprint, database, logs)

Examples: ?route=details.files, ?route=blueprints, ?route=closed

Key changes:
- Add route parsing/building utilities in router.ts
- Add activeTab to Redux UI state with URL sync
- Filter UI-only params (route, modal) when comparing URLs to prevent
  unnecessary playground reloads when only navigation state changes
- Reset to Settings tab when clicking a site in the sidebar
- Add E2E tests for route persistence across page reloads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants