diff --git a/src/Components/Curtains/Curtains.tsx b/src/Components/Curtains/Curtains.tsx index ffa5b45..6470190 100644 --- a/src/Components/Curtains/Curtains.tsx +++ b/src/Components/Curtains/Curtains.tsx @@ -135,12 +135,13 @@ export function Curtains({children}: React.PropsWithChildren<{}>) remove.current = useCallback((uuid: CurtainUuidType) => { // Copy the curtains list. const newCurtains = {...curtains}; + const newClosedCurtains = {...closedCurtains}; // Remove the given curtain from the list. delete newCurtains[uuid]; - delete closedCurtains[uuid]; + delete newClosedCurtains[uuid]; // Set the new curtains list. setCurtains(newCurtains); - setClosedCurtains(closedCurtains); + setClosedCurtains(newClosedCurtains); }, [curtains, setCurtains, closedCurtains, setClosedCurtains]); // Initialize close curtain function with animation.