mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 16:03:26 +00:00
fix(diff): avoid render-time ref mutation in section model lifecycle
React Doctor fails static analysis when refs are written during render. Move the disposer ref sync into an effect so the stable callback-ref still disposes with the latest model paths.
This commit is contained in:
@@ -20,7 +20,10 @@ export function useDiffSectionModelLifecycle(params: {
|
||||
}, 0)
|
||||
}, [params.modelPathBase])
|
||||
const disposeDiffModelsRef = useRef(disposeDiffModels)
|
||||
disposeDiffModelsRef.current = disposeDiffModels
|
||||
// Keep callback-ref dispose path on the latest disposer without render-time mutation.
|
||||
useEffect(() => {
|
||||
disposeDiffModelsRef.current = disposeDiffModels
|
||||
}, [disposeDiffModels])
|
||||
|
||||
const setSectionRootNode = useCallback((node: HTMLDivElement | null): void => {
|
||||
if (node) {
|
||||
|
||||
Reference in New Issue
Block a user