You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							20 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							20 lines
						
					
					
						
							1.1 KiB
						
					
					
				| "use strict";
 | |
| 
 | |
| exports.__esModule = true;
 | |
| exports.useIsomorphicLayoutEffect = exports.canUseDOM = void 0;
 | |
| 
 | |
| var _react = require("react");
 | |
| 
 | |
| // React currently throws a warning when using useLayoutEffect on the server.
 | |
| // To get around it, we can conditionally useEffect on the server (no-op) and
 | |
| // useLayoutEffect in the browser. We need useLayoutEffect to ensure the store
 | |
| // subscription callback always has the selector from the latest render commit
 | |
| // available, otherwise a store update may happen between render and the effect,
 | |
| // which may cause missed updates; we also must ensure the store subscription
 | |
| // is created synchronously, otherwise a store update may occur before the
 | |
| // subscription is created and an inconsistent state may be observed
 | |
| // Matches logic in React's `shared/ExecutionEnvironment` file
 | |
| const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
 | |
| exports.canUseDOM = canUseDOM;
 | |
| const useIsomorphicLayoutEffect = canUseDOM ? _react.useLayoutEffect : _react.useEffect;
 | |
| exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; |