Skip to content

Commit

Permalink
move up layout effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaGurevich committed Sep 11, 2023
1 parent d1c8f4f commit 478cefb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/hooks/useEditorView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ export function useEditorView<T extends HTMLElement = HTMLElement>(
)
);

useLayoutEffect(() => {
editorPropsRef.current = withConditionalFlushDispatch(
props,
forceUpdate,
view
);
}, [props, view, forceUpdate]);

useLayoutEffect(() => {
return () => {
if (view) {
Expand Down Expand Up @@ -146,13 +154,5 @@ export function useEditorView<T extends HTMLElement = HTMLElement>(
if (stateProp) view?.setProps({ state: stateProp });
}, [view, stateProp]);

useLayoutEffect(() => {
editorPropsRef.current = withConditionalFlushDispatch(
props,
forceUpdate,
view
);
}, [props, view, forceUpdate]);

return view;
}

0 comments on commit 478cefb

Please sign in to comment.