Skip to content

Commit

Permalink
revert: "fix: optimizing useCodeMirror rendering issues. (#474)"
Browse files Browse the repository at this point in the history
This reverts commit 5eee5f4.
  • Loading branch information
jaywcjlove committed Mar 25, 2023
1 parent 952423f commit 2fbfc8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const ReactCodeMirror = forwardRef<ReactCodeMirrorRef, ReactCodeMirrorProps>((pr
} = props;
const editor = useRef<HTMLDivElement>(null);
const { state, view, container } = useCodeMirror({
container: editor.current ? editor.current : undefined,
container: editor.current,
root,
value,
autoFocus,
Expand Down
4 changes: 2 additions & 2 deletions core/src/useCodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ReactCodeMirrorProps } from '.';
const External = Annotation.define<boolean>();

export interface UseCodeMirror extends ReactCodeMirrorProps {
container?: HTMLDivElement;
container?: HTMLDivElement | null;
}

export function useCodeMirror(props: UseCodeMirror) {
Expand Down Expand Up @@ -147,7 +147,7 @@ export function useCodeMirror(props: UseCodeMirror) {
};
}, [container, state]);

useEffect(() => setContainer(props.container), [props.container]);
useEffect(() => setContainer(props.container!), [props.container]);

useEffect(
() => () => {
Expand Down

0 comments on commit 2fbfc8f

Please sign in to comment.