File tree Expand file tree Collapse file tree
packages/react-native-livechart/src/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -586,9 +586,12 @@ export function useLiveChartEngine(
586586 extremaMinTime,
587587 extremaMaxTime,
588588 } ;
589- const [ frameScratchRef ] = useState ( ( ) => ( {
590- current : makeEngineFrameScratch ( ) ,
591- } ) ) ;
589+ const frameScratchRef = useRef < EngineFrameScratch | null > ( null ) ;
590+ if ( frameScratchRef . current === null ) {
591+ // React permits this predictable lazy-ref initialization: https://react.dev/reference/react/useRef#avoiding-recreating-the-ref-contents
592+ // react-doctor-disable-next-line react-doctor/no-ref-current-in-render -- false positive for React's documented lazy-ref exception
593+ frameScratchRef . current = makeEngineFrameScratch ( ) ;
594+ }
592595
593596 // `autostart=false` registers the frame callback without running it — the live
594597 // loop is fully inert in static mode (the invariant that makes this worth it).
You can’t perform that action at this time.
0 commit comments