@etsoo/toolpad 1.0.33 → 1.0.35
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.
|
@@ -89,14 +89,8 @@ function PageDataContextProvider(props) {
|
|
|
89
89
|
}
|
|
90
90
|
function PageContainerBar(props) {
|
|
91
91
|
const { slots, slotProps, titleBar } = props;
|
|
92
|
-
const { state
|
|
92
|
+
const { state } = React.useContext(exports.PageDataContext);
|
|
93
93
|
const activePage = (0, useActivePage_1.useActivePage)();
|
|
94
|
-
React.useEffect(() => {
|
|
95
|
-
return () => {
|
|
96
|
-
// Reset the state when the component unmounts
|
|
97
|
-
dispatch({});
|
|
98
|
-
};
|
|
99
|
-
}, [activePage?.sourcePath]);
|
|
100
94
|
const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar_1.PageContainerToolbar;
|
|
101
95
|
const toolbarSlotProps = (0, useSlotProps_1.default)({
|
|
102
96
|
elementType: ToolbarComponent,
|
|
@@ -107,6 +101,13 @@ function PageContainerBar(props) {
|
|
|
107
101
|
const breadcrumbs = [...(state.breadcrumbs ?? activePage?.breadcrumbs ?? [])];
|
|
108
102
|
const title = state.title ?? activePage?.title ?? "";
|
|
109
103
|
const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
// Reset the state
|
|
106
|
+
state.breadcrumbs = undefined;
|
|
107
|
+
state.page = undefined;
|
|
108
|
+
state.pageHeader = undefined;
|
|
109
|
+
state.title = undefined;
|
|
110
|
+
}, [activePage?.sourcePath]);
|
|
110
111
|
// No page header
|
|
111
112
|
if (pageHeader === false)
|
|
112
113
|
return undefined;
|
|
@@ -48,14 +48,8 @@ export function PageDataContextProvider(props) {
|
|
|
48
48
|
}
|
|
49
49
|
function PageContainerBar(props) {
|
|
50
50
|
const { slots, slotProps, titleBar } = props;
|
|
51
|
-
const { state
|
|
51
|
+
const { state } = React.useContext(PageDataContext);
|
|
52
52
|
const activePage = useActivePage();
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
return () => {
|
|
55
|
-
// Reset the state when the component unmounts
|
|
56
|
-
dispatch({});
|
|
57
|
-
};
|
|
58
|
-
}, [activePage?.sourcePath]);
|
|
59
53
|
const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar;
|
|
60
54
|
const toolbarSlotProps = useSlotProps({
|
|
61
55
|
elementType: ToolbarComponent,
|
|
@@ -66,6 +60,13 @@ function PageContainerBar(props) {
|
|
|
66
60
|
const breadcrumbs = [...(state.breadcrumbs ?? activePage?.breadcrumbs ?? [])];
|
|
67
61
|
const title = state.title ?? activePage?.title ?? "";
|
|
68
62
|
const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
// Reset the state
|
|
65
|
+
state.breadcrumbs = undefined;
|
|
66
|
+
state.page = undefined;
|
|
67
|
+
state.pageHeader = undefined;
|
|
68
|
+
state.title = undefined;
|
|
69
|
+
}, [activePage?.sourcePath]);
|
|
69
70
|
// No page header
|
|
70
71
|
if (pageHeader === false)
|
|
71
72
|
return undefined;
|
package/package.json
CHANGED
|
@@ -114,17 +114,10 @@ type PageContainerBarProps = {
|
|
|
114
114
|
function PageContainerBar(props: PageContainerBarProps) {
|
|
115
115
|
const { slots, slotProps, titleBar } = props;
|
|
116
116
|
|
|
117
|
-
const { state
|
|
117
|
+
const { state } = React.useContext(PageDataContext);
|
|
118
118
|
|
|
119
119
|
const activePage = useActivePage();
|
|
120
120
|
|
|
121
|
-
React.useEffect(() => {
|
|
122
|
-
return () => {
|
|
123
|
-
// Reset the state when the component unmounts
|
|
124
|
-
dispatch({});
|
|
125
|
-
};
|
|
126
|
-
}, [activePage?.sourcePath]);
|
|
127
|
-
|
|
128
121
|
const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar;
|
|
129
122
|
const toolbarSlotProps = useSlotProps({
|
|
130
123
|
elementType: ToolbarComponent,
|
|
@@ -137,6 +130,14 @@ function PageContainerBar(props: PageContainerBarProps) {
|
|
|
137
130
|
const title = state.title ?? activePage?.title ?? "";
|
|
138
131
|
const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
|
|
139
132
|
|
|
133
|
+
React.useEffect(() => {
|
|
134
|
+
// Reset the state
|
|
135
|
+
state.breadcrumbs = undefined;
|
|
136
|
+
state.page = undefined;
|
|
137
|
+
state.pageHeader = undefined;
|
|
138
|
+
state.title = undefined;
|
|
139
|
+
}, [activePage?.sourcePath]);
|
|
140
|
+
|
|
140
141
|
// No page header
|
|
141
142
|
if (pageHeader === false) return undefined;
|
|
142
143
|
|