@etsoo/toolpad 1.0.36 → 1.0.38

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.
@@ -27,7 +27,7 @@ export type PageData = {
27
27
  breadcrumbs?: Breadcrumb[];
28
28
  pageHeader?: React.ReactNode;
29
29
  };
30
- type PageDataAction = PageData;
30
+ type PageDataAction = PageData | true;
31
31
  export declare const PageDataContext: React.Context<{
32
32
  state: PageData;
33
33
  dispatch: React.Dispatch<PageDataAction>;
@@ -63,6 +63,10 @@ function jsonSerialize(obj) {
63
63
  }
64
64
  exports.PageDataContext = React.createContext({ state: {}, dispatch: (value) => value });
65
65
  function reducer(state, action) {
66
+ // Check if the action is 'reset'
67
+ if (action === true) {
68
+ return {};
69
+ }
66
70
  // Check if the action is the same as the current state
67
71
  if (jsonSerialize(state) === jsonSerialize(action)) {
68
72
  return state;
@@ -27,7 +27,7 @@ export type PageData = {
27
27
  breadcrumbs?: Breadcrumb[];
28
28
  pageHeader?: React.ReactNode;
29
29
  };
30
- type PageDataAction = PageData;
30
+ type PageDataAction = PageData | true;
31
31
  export declare const PageDataContext: React.Context<{
32
32
  state: PageData;
33
33
  dispatch: React.Dispatch<PageDataAction>;
@@ -22,6 +22,10 @@ function jsonSerialize(obj) {
22
22
  }
23
23
  export const PageDataContext = React.createContext({ state: {}, dispatch: (value) => value });
24
24
  function reducer(state, action) {
25
+ // Check if the action is 'reset'
26
+ if (action === true) {
27
+ return {};
28
+ }
25
29
  // Check if the action is the same as the current state
26
30
  if (jsonSerialize(state) === jsonSerialize(action)) {
27
31
  return state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/toolpad",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "author": "ETSOO",
5
5
  "description": "Dashboard framework extention based on Toolpad Core",
6
6
  "main": "build/cjs/index.js",
@@ -51,7 +51,7 @@ export type PageData = {
51
51
  pageHeader?: React.ReactNode;
52
52
  };
53
53
 
54
- type PageDataAction = PageData;
54
+ type PageDataAction = PageData | true;
55
55
 
56
56
  function jsonSerialize(obj: unknown) {
57
57
  return JSON.stringify(obj, (_key, value) =>
@@ -65,6 +65,11 @@ export const PageDataContext = React.createContext<{
65
65
  }>({ state: {}, dispatch: (value) => value });
66
66
 
67
67
  function reducer(state: PageData, action: PageDataAction) {
68
+ // Check if the action is 'reset'
69
+ if (action === true) {
70
+ return {};
71
+ }
72
+
68
73
  // Check if the action is the same as the current state
69
74
  if (jsonSerialize(state) === jsonSerialize(action)) {
70
75
  return state;