@etsoo/toolpad 1.0.34 → 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,16 +89,8 @@ function PageDataContextProvider(props) {
89
89
  }
90
90
  function PageContainerBar(props) {
91
91
  const { slots, slotProps, titleBar } = props;
92
- const { state, dispatch } = React.useContext(exports.PageDataContext);
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
- console.log("PageContainerBar unmounted", activePage?.sourcePath);
99
- };
100
- }, [activePage?.sourcePath]);
101
- console.log("PageContainerBar", activePage?.sourcePath, state);
102
94
  const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar_1.PageContainerToolbar;
103
95
  const toolbarSlotProps = (0, useSlotProps_1.default)({
104
96
  elementType: ToolbarComponent,
@@ -109,7 +101,13 @@ function PageContainerBar(props) {
109
101
  const breadcrumbs = [...(state.breadcrumbs ?? activePage?.breadcrumbs ?? [])];
110
102
  const title = state.title ?? activePage?.title ?? "";
111
103
  const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
112
- console.log("PageContainerBar", activePage?.sourcePath, title, breadcrumbs);
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]);
113
111
  // No page header
114
112
  if (pageHeader === false)
115
113
  return undefined;
@@ -48,16 +48,8 @@ export function PageDataContextProvider(props) {
48
48
  }
49
49
  function PageContainerBar(props) {
50
50
  const { slots, slotProps, titleBar } = props;
51
- const { state, dispatch } = React.useContext(PageDataContext);
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
- console.log("PageContainerBar unmounted", activePage?.sourcePath);
58
- };
59
- }, [activePage?.sourcePath]);
60
- console.log("PageContainerBar", activePage?.sourcePath, state);
61
53
  const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar;
62
54
  const toolbarSlotProps = useSlotProps({
63
55
  elementType: ToolbarComponent,
@@ -68,7 +60,13 @@ function PageContainerBar(props) {
68
60
  const breadcrumbs = [...(state.breadcrumbs ?? activePage?.breadcrumbs ?? [])];
69
61
  const title = state.title ?? activePage?.title ?? "";
70
62
  const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
71
- console.log("PageContainerBar", activePage?.sourcePath, title, breadcrumbs);
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]);
72
70
  // No page header
73
71
  if (pageHeader === false)
74
72
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/toolpad",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "author": "ETSOO",
5
5
  "description": "Dashboard framework extention based on Toolpad Core",
6
6
  "main": "build/cjs/index.js",
@@ -114,20 +114,10 @@ type PageContainerBarProps = {
114
114
  function PageContainerBar(props: PageContainerBarProps) {
115
115
  const { slots, slotProps, titleBar } = props;
116
116
 
117
- const { state, dispatch } = React.useContext(PageDataContext);
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
- console.log("PageContainerBar unmounted", activePage?.sourcePath);
126
- };
127
- }, [activePage?.sourcePath]);
128
-
129
- console.log("PageContainerBar", activePage?.sourcePath, state);
130
-
131
121
  const ToolbarComponent = slots?.toolbar ?? PageContainerToolbar;
132
122
  const toolbarSlotProps = useSlotProps({
133
123
  elementType: ToolbarComponent,
@@ -140,7 +130,13 @@ function PageContainerBar(props: PageContainerBarProps) {
140
130
  const title = state.title ?? activePage?.title ?? "";
141
131
  const pageHeader = state.pageHeader ?? activePage?.pageHeader ?? null;
142
132
 
143
- console.log("PageContainerBar", activePage?.sourcePath, title, breadcrumbs);
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]);
144
140
 
145
141
  // No page header
146
142
  if (pageHeader === false) return undefined;