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