Skip to content

Commit

Permalink
export handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
ashit-rath committed Feb 18, 2025
1 parent b410188 commit ec13bb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function getUpdatedWidgetLists(
);
}

const canvasWidgetsReducer = createImmerReducer(initialState, {
export const handlers = {
[ReduxActionTypes.INIT_CANVAS_LAYOUT]: (
state: CanvasWidgetsReduxState,
action: ReduxAction<UpdateCanvasPayload>,
Expand Down Expand Up @@ -166,10 +166,12 @@ const canvasWidgetsReducer = createImmerReducer(initialState, {

return state;
},
});
};

export interface CanvasWidgetsReduxState {
[widgetId: string]: FlattenedWidgetProps;
}

const canvasWidgetsReducer = createImmerReducer(initialState, handlers);

export default canvasWidgetsReducer;
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export interface CanvasWidgetsStructureReduxState {
topRow: number;
}

const initialState: CanvasWidgetsStructureReduxState = {
export const initialState: CanvasWidgetsStructureReduxState = {
type: "CANVAS_WIDGET",
widgetId: MAIN_CONTAINER_WIDGET_ID,
topRow: 0,
bottomRow: CANVAS_DEFAULT_MIN_ROWS,
};

const canvasWidgetsStructureReducer = createImmerReducer(initialState, {
export const handlers = {
[ReduxActionTypes.INIT_CANVAS_LAYOUT]: (
state: CanvasWidgetsStructureReduxState,
action: ReduxAction<UpdateCanvasPayload>,
Expand All @@ -47,6 +47,11 @@ const canvasWidgetsStructureReducer = createImmerReducer(initialState, {
[ReduxActionTypes.RESET_EDITOR_REQUEST]: () => {
return klona(initialState);
},
});
};

const canvasWidgetsStructureReducer = createImmerReducer(
initialState,
handlers,
);

export default canvasWidgetsStructureReducer;

0 comments on commit ec13bb0

Please sign in to comment.