@etsoo/toolpad 1.0.24 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,6 +114,8 @@ function PageContainer(props) {
114
114
  loaded.current = true;
115
115
  }
116
116
  }, [activePage?.sourcePath]);
117
+ // Cache the children to avoid re-rendering when the page changes
118
+ const childrenResult = React.useMemo(() => children, [activePage?.sourcePath]);
117
119
  let resolvedBreadcrumbs = state.breadcrumbs ?? activePage?.breadcrumbs ?? [];
118
120
  const title = state.title ?? defaultTitle ?? activePage?.title ?? "";
119
121
  if (state.page) {
@@ -133,5 +135,5 @@ function PageContainer(props) {
133
135
  ? resolvedBreadcrumbs.map((item, index) => {
134
136
  return index < resolvedBreadcrumbs.length - 1 ? ((0, jsx_runtime_1.jsx)(Link_1.default, { component: Link_2.Link, underline: "hover", color: "inherit", href: item.path, children: (0, navigation_1.getItemTitle)(item) }, item.path)) : ((0, jsx_runtime_1.jsx)(Typography_1.default, { color: "text.primary", children: (0, navigation_1.getItemTitle)(item) }, item.path));
135
137
  })
136
- : null })), (0, jsx_runtime_1.jsxs)(PageContentHeader, { children: [title ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h4", children: title }) : null, (0, jsx_runtime_1.jsx)(ToolbarComponent, { ...toolbarSlotProps })] })] })), children] }));
138
+ : null })), (0, jsx_runtime_1.jsxs)(PageContentHeader, { children: [title ? (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "h4", children: title }) : null, (0, jsx_runtime_1.jsx)(ToolbarComponent, { ...toolbarSlotProps })] })] })), childrenResult] }));
137
139
  }
@@ -73,6 +73,8 @@ function PageContainer(props) {
73
73
  loaded.current = true;
74
74
  }
75
75
  }, [activePage?.sourcePath]);
76
+ // Cache the children to avoid re-rendering when the page changes
77
+ const childrenResult = React.useMemo(() => children, [activePage?.sourcePath]);
76
78
  let resolvedBreadcrumbs = state.breadcrumbs ?? activePage?.breadcrumbs ?? [];
77
79
  const title = state.title ?? defaultTitle ?? activePage?.title ?? "";
78
80
  if (state.page) {
@@ -92,6 +94,6 @@ function PageContainer(props) {
92
94
  ? resolvedBreadcrumbs.map((item, index) => {
93
95
  return index < resolvedBreadcrumbs.length - 1 ? (_jsx(Link, { component: ToolpadLink, underline: "hover", color: "inherit", href: item.path, children: getItemTitle(item) }, item.path)) : (_jsx(Typography, { color: "text.primary", children: getItemTitle(item) }, item.path));
94
96
  })
95
- : null })), _jsxs(PageContentHeader, { children: [title ? _jsx(Typography, { variant: "h4", children: title }) : null, _jsx(ToolbarComponent, { ...toolbarSlotProps })] })] })), children] }));
97
+ : null })), _jsxs(PageContentHeader, { children: [title ? _jsx(Typography, { variant: "h4", children: title }) : null, _jsx(ToolbarComponent, { ...toolbarSlotProps })] })] })), childrenResult] }));
96
98
  }
97
99
  export { PageContainer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/toolpad",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "author": "ETSOO",
5
5
  "description": "Dashboard framework extention based on Toolpad Core",
6
6
  "main": "build/cjs/index.js",
@@ -61,19 +61,19 @@
61
61
  "@babel/preset-env": "^7.26.9",
62
62
  "@babel/runtime-corejs3": "^7.27.0",
63
63
  "@testing-library/jest-dom": "^6.6.3",
64
- "@testing-library/react": "^16.2.0",
64
+ "@testing-library/react": "^16.3.0",
65
65
  "@types/invariant": "2.2.37",
66
- "@types/node": "^22.13.14",
67
- "@types/react": "19.0.12",
68
- "@types/react-dom": "19.0.4",
66
+ "@types/node": "^22.14.0",
67
+ "@types/react": "19.1.0",
68
+ "@types/react-dom": "19.1.1",
69
69
  "@vitejs/plugin-react": "4.3.4",
70
- "@vitest/browser": "3.0.9",
70
+ "@vitest/browser": "3.1.1",
71
71
  "jsdom": "^26.0.0",
72
72
  "next": "^15.2.4",
73
73
  "next-router-mock": "^0.9.13",
74
74
  "playwright": "^1.51.1",
75
75
  "react-router-dom": "7.4.1",
76
- "vitest": "3.0.9"
76
+ "vitest": "3.1.1"
77
77
  },
78
78
  "peerDependenciesMeta": {
79
79
  "next": {
@@ -143,6 +143,12 @@ function PageContainer(props: PageContainerProps) {
143
143
  }
144
144
  }, [activePage?.sourcePath]);
145
145
 
146
+ // Cache the children to avoid re-rendering when the page changes
147
+ const childrenResult = React.useMemo(
148
+ () => children,
149
+ [activePage?.sourcePath]
150
+ );
151
+
146
152
  let resolvedBreadcrumbs = state.breadcrumbs ?? activePage?.breadcrumbs ?? [];
147
153
  const title = state.title ?? defaultTitle ?? activePage?.title ?? "";
148
154
 
@@ -194,7 +200,7 @@ function PageContainer(props: PageContainerProps) {
194
200
  </PageContentHeader>
195
201
  </Stack>
196
202
  )}
197
- {children}
203
+ {childrenResult}
198
204
  </Stack>
199
205
  );
200
206
  }