Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Replace Jotai with @tanstack/router #2359

Merged
merged 5 commits into from
Feb 15, 2024
Merged

Replace Jotai with @tanstack/router #2359

merged 5 commits into from
Feb 15, 2024

Conversation

sandhose
Copy link
Member

This replaces Jotai completely with @tanstack/router.

Fixes #1713

This makes the routing much simpler to understand, as it uses a file-based structure to define routes.
It makes defining error boundaries and not found boundaries way easier.
It makes it way easier to pre-load data before changing pages

The nested routing should help making the individual session view a modal on top of the list.

The main thing that changes are the URLs.

  • /sessions-overview -> /sessions
  • /browser-sessions -> /sessions/browsers
  • /session/:deviceId -> /sessions/:id (note that we now use the session ID here, not the device ID)
  • /devices/:deviceId now redirects to the corresponding /sessions/:id page

A few points of interest when looking at the code:

  • src/routes/__root.tsx has the MSC2965 ?action parameter handling
  • src/routes/_account.tsx: for pages which uses the user greeting + tabs, this "ghost" page is used to define this common layout, but without applying it to all pages.
  • test-utils/router.tsx has a test helper to create a dummy router with just an index route, which renders whatever children you give it

This also makes sure everything is properly loaded in the route loader,
and we use fragment where it makes sense
@sandhose sandhose added the A-Frontend Changes on the React frontend label Feb 15, 2024
Copy link

cloudflare-workers-and-pages bot commented Feb 15, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d62593
Status: ✅  Deploy successful!
Preview URL: https://aa7a253b.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://quenting-remove-jotai.matrix-authentication-service-docs.pages.dev

View logs

@sandhose sandhose requested a review from t3chguy February 15, 2024 13:37
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane

@sandhose sandhose merged commit e041f47 into main Feb 15, 2024
16 of 18 checks passed
@sandhose sandhose deleted the quenting/remove-jotai branch February 28, 2024 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Frontend Changes on the React frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve UI for device-less sessions
2 participants