Skip to content

Commit

Permalink
fix: removed patch row preview (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Jul 4, 2024
1 parent 8b50337 commit f97e0dc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
6 changes: 0 additions & 6 deletions src/providers/exploreState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import {
getEntityStateSavedSorting,
getFilterCount,
patchEntityListItems,
patchRowPreview,
resetPage,
updateEntityPageState,
updateEntityPageStateWithCommonCategoryGroupConfigKey,
Expand Down Expand Up @@ -491,11 +490,6 @@ function exploreReducer(
payload.updatedListItems,
payload.listItemKey
),
rowPreview: patchRowPreview(
state.rowPreview,
payload.updatedListItems,
payload.listItemKey
),
};
}
/**
Expand Down
21 changes: 0 additions & 21 deletions src/providers/exploreState/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,27 +156,6 @@ export function patchEntityListItems(
return [...listItemById.values()];
}

/**
* Returns the updated row preview state with the updated list item patched.
* @param rowPreview - Row preview state.
* @param updatedListItems - List items to patch.
* @param listItemKey - List item key identifier to map list items.
* @returns row preview state with updated list item patched.
*/
export function patchRowPreview(
rowPreview: RowPreviewState,
updatedListItems: ListItems,
listItemKey: keyof ListItem
): RowPreviewState {
if (!rowPreview || !updatedListItems) return rowPreview;
for (const updatedListItem of updatedListItems) {
if (updatedListItem[listItemKey] === rowPreview.id) {
return { ...rowPreview, original: updatedListItem };
}
}
return rowPreview;
}

/**
* Resets pagination.
* @param paginationState - Pagination state.
Expand Down

0 comments on commit f97e0dc

Please sign in to comment.