MCPcopy
hub / github.com/visgl/deck.gl / handleViewStateChange

Function handleViewStateChange

modules/react/src/deckgl.ts:139–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers 1

DeckGLWithRefFunction · 0.85

Calls 1

onViewStateChangeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…