Skip to content

Commit

Permalink
enable structural sharing by default in react (#26)
Browse files Browse the repository at this point in the history
also added `scrollRestoration` and `defaultPreload` options so all
templates use the same props
  • Loading branch information
schiller-manuel authored Feb 25, 2025
1 parent 69c6e3e commit 1413389
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/react/base/README.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ import "./styles.css";
import reportWebVitals from "./reportWebVitals.<%= js %>";
// Create a new router instance
const router = createRouter({ routeTree });
const router = createRouter({ routeTree, defaultPreload: "intent", scrollRestoration: true, defaultStructuralSharing: true });
<% if (typescript) { %>
// Register the router instance for type safety
declare module "@tanstack/react-router" {
Expand Down
1 change: 1 addition & 0 deletions templates/react/code-router/src/main.tsx.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const router = createRouter({
routeTree,
defaultPreload: "intent",
scrollRestoration: true,
defaultStructuralSharing: true,
});
<% if (typescript) { %>
declare module "@tanstack/react-router" {
Expand Down
2 changes: 1 addition & 1 deletion templates/react/file-router/src/main.tsx.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "./styles.css";
import reportWebVitals from "./reportWebVitals.<%= js %>";

// Create a new router instance
const router = createRouter({ routeTree });
const router = createRouter({ routeTree, defaultPreload: "intent", scrollRestoration: true, defaultStructuralSharing: true });

// Register the router instance for type safety
declare module "@tanstack/react-router" {
Expand Down

0 comments on commit 1413389

Please sign in to comment.