Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Define routes statically #3176

Merged
merged 10 commits into from
Feb 8, 2024
Merged

[core] Define routes statically #3176

merged 10 commits into from
Feb 8, 2024

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Feb 7, 2024

Define the routes statically. In preparation for moving to react-router new API with createBrowserRouter. Which allows for lazy-loading routes. This will be interesting in the long term future to do code splitting between pages, but necessary in the short term to host the editor alongside the application for #3171

Statically means that the whole routing is now defined in:

<Routes>
  <Route path="/signin" element={<SignInPage />} />
  <Route path="/" element={<ToolpadAppLayout />}>
    <Route path="/pages/:pageName" element={<RenderedPage />} />
    <Route path="/pages" element={<DefaultPageNavigation />} />
    <Route path="/" element={<DefaultPageNavigation />} />
    <Route path="*" element={<PageNotFound />} />
  </Route>
</Routes>

In this PR:

  • defines the routes statically
  • fixes error when no pages are available in the app
  • uses outlet to render child routes in app layout

@Janpot Janpot added the core Infrastructure work going on behind the scenes label Feb 7, 2024
@Janpot Janpot marked this pull request as ready for review February 8, 2024 04:12
@Janpot Janpot requested a review from a team February 8, 2024 04:12
@Janpot
Copy link
Member Author

Janpot commented Feb 8, 2024

I'm merging this. Feel free to review in retrospect.

@Janpot Janpot merged commit 34afb1a into mui:master Feb 8, 2024
11 checks passed
@Janpot Janpot deleted the static-routes branch February 8, 2024 11:09
Copy link
Member

@bharatkashyap bharatkashyap left a comment

Choose a reason for hiding this comment

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

👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants