Skip to content

Commit

Permalink
rename hash to panelSizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Psvensso committed Jan 11, 2024
1 parent 17e7717 commit ba23f9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/react-resizable-panels/src/utils/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type PanelGroupState = {
[panelId: string]: number;
};
layout: number[];
hash?: Record<string, number>;
panelSizes?: Record<string, number>;
};

function getPanelGroupKey(autoSaveId: string): string {
Expand Down Expand Up @@ -85,8 +85,8 @@ export function loadPanelGroupState(

return {
expandToSizes: state.expandToSizes || {},
layout: panels.map(({ id }) => state?.hash?.[id] || 0),
hash: state.hash || {},
layout: panels.map(({ id }) => state?.panelSizes?.[id] || 0),
panelSizes: state.panelSizes || {},
};
}

Expand All @@ -101,8 +101,8 @@ export function savePanelGroupState(
const oldState = loadPanelGroupState(autoSaveId, panels, storage);
const newState = {
expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
hash: {
...oldState?.hash,
panelSizes: {
...oldState?.panelSizes,
...panels.reduce<Record<string, number>>((acc, panel, i) => {
acc[panel.id] = sizes[i] || 0;
return acc;
Expand Down

0 comments on commit ba23f9f

Please sign in to comment.