Fix mutated closedCurtains state in curtains.
This commit is contained in:
		
							parent
							
								
									f3c8a9858b
								
							
						
					
					
						commit
						ed4e766650
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue