Scrolled view is not updated until click

Hi,
The visible area is not updated after the scroll.
I need to click on the last line, and then the visible dom is updated.

Please see the attached video. After scrolling, you will see the empty space. After clicking on the last line, the visible area is updated. This behavior is not observed when scrolling with selection.

www_screencapture_com_2022-10-10_17_47 (1)


const cmdTheme = EditorView.theme({
    "&": {
        color: "white",
        backgroundColor: "black",
        minWidth: '50em',
        minHeight: '15em',
        maxHeight: '15em',
    },
    ".cm-scroller": { overflow: "auto" }
}, { dark: true })
const cmdState = EditorState.create({
    doc: defaultCmdText,
    extensions: [
        cmdTheme,
        EditorView.editable.of(false),
        EditorView.lineWrapping,
    ]
})
const cmd = useRef<EditorView | null>(null);
const cmdContainerRef = useRef(null);

useEffect(() => {
        cmd.current = new EditorView({
            state: cmdState,
            parent: cmdContainerRef.current || undefined,
        });

        return () => {
            cmd.current?.destroy();
        }
    }, []);

<div ref={cmdContainerRef} />

Interesting. I don’t know what might be going on there. Can you provide a self-contained, minimal script that reproduces this? The code you pasted doesn’t seem to show the issue, on its own.

Hi Thank you your quick response.

I created a sandbox project and managed to obtain the same anomaly. Please see the project below.

https://codesandbox.io/s/react-fiddle-forked-g7xzt9?file=/src/Components/LoggerConsole.js

This seems to be caused by something that the Collapse wrapper is doing when it expands the code, but just setting up a similar height transition in a raw element doesn’t trigger it. I don’t have time to dig through that, but if you can condense this to a simple script that doesn’t use react or any external non-CodeMirror components I’ll try to debug it.

Thanks for your reply and investigation.
You can close this issue, I’ll try to debug the Collapse wrapper.
Thanks

Do you remember the reason? I have the sane issue and do not know how to fix.

1 Like