Skip to content

Commit

Permalink
Merge pull request #10989 from wellcomecollection/fix-item-requesting…
Browse files Browse the repository at this point in the history
…-take2

add items as dependency for setItemsState
  • Loading branch information
agnesgaroux authored Jul 4, 2024
2 parents 82a8177 + 566234b commit d456485
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions content/webapp/components/PhysicalItems/PhysicalItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const useItemsState = (

useEffect(() => {
setItemsState(getItemsState(items, offsiteRequesting));
}, []);
}, [items]);

return [itemsState, setItemsState];
};
Expand All @@ -92,10 +92,8 @@ const PhysicalItems: FunctionComponent<Props> = ({
offsiteRequesting
);

// This ensures we update an items availability
// if the user navigates between items using the archive tree
useEffect(() => {
setItemsState(getItemsState(workItems, offsiteRequesting || false));
setPhysicalItems(workItems);
}, [workItems]);

useAbortSignalEffect(
Expand Down

0 comments on commit d456485

Please sign in to comment.