| 137 | let inRender = true; |
| 138 | |
| 139 | const handleViewStateChange: DeckProps<ViewsT>['onViewStateChange'] = params => { |
| 140 | if (inRender && props.viewState) { |
| 141 | // Callback may invoke a state update. Defer callback to after render() to avoid React error |
| 142 | // In React StrictMode, render is executed twice and useEffect/useLayoutEffect is executed once |
| 143 | // Store deferred parameters in ref so that we can access it in another render |
| 144 | thisRef.viewStateUpdateRequested = params; |
| 145 | return null; |
| 146 | } |
| 147 | thisRef.viewStateUpdateRequested = null; |
| 148 | return props.onViewStateChange?.(params); |
| 149 | }; |
| 150 | |
| 151 | const handleInteractionStateChange: DeckProps<ViewsT>['onInteractionStateChange'] = params => { |
| 152 | if (inRender) { |
no test coverage detected
searching dependent graphs…