Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of null (reading 'set') #568

Closed
zjy365 opened this issue Sep 19, 2023 · 14 comments
Closed

TypeError: Cannot read properties of null (reading 'set') #568

zjy365 opened this issue Sep 19, 2023 · 14 comments

Comments

@zjy365
Copy link

zjy365 commented Sep 19, 2023

Here's how I use it

            <CodeMirror
              extensions={[StreamLanguage.define(yaml)]}
              width="100%"
              height="100%"
              minHeight="1200px"
              onChange={debounce(onYamlChange, 1000)}
            />

my version

    "@codemirror/language": "^6.8.0",
    "@codemirror/legacy-modes": "^6.3.3",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "@kubernetes/client-node": "^0.18.1",
    "@next/font": "13.1.6",
    "@tanstack/react-query": "^4.24.10",
    "@uiw/react-codemirror": "^4.21.9",

When I mouseover this editor section, the console output is consistent. this error

image
@jaywcjlove
Copy link
Member

@zjy365 Can you provide me with a reproducible example using https://codesandbox.io? I can help you troubleshoot the issue.

@zjy365
Copy link
Author

zjy365 commented Sep 19, 2023

@jaywcjlove I created a new next project and tried it. You can take a look.
https://codesandbox.io/p/sandbox/xenodochial-robinson-9yfw8c

@jaywcjlove
Copy link
Member

image

There are no errors when downloading the project locally.

image image

@zjy365 So, I cannot reproduce your error.

@noa24
Copy link

noa24 commented Sep 19, 2023

i also have the same issue

@zjy365
Copy link
Author

zjy365 commented Sep 19, 2023

The mouse needs to move within this area to trigger the 'mousemove' event, or if there is any input in the editor, it will trigger the 'error' event mentioned above.

image

@jaywcjlove

@chenbinli-dev
Copy link

i have the same issuse☹️

@jaywcjlove
Copy link
Member

jaywcjlove commented Sep 20, 2023

iShot_2023-09-20_10.32.46.mp4

https://github.com/uiwjs/react-codemirror/tree/master/example/nextjs

I recreated the nextjs project and the error disappeared.

@codercoin98 @zjy365 @noa24

@se1phine
Copy link

image

@zlytxx
Copy link

zlytxx commented Sep 20, 2023

i have the same issuse too, only set the onChange props will show

@zlytxx
Copy link

zlytxx commented Sep 20, 2023

@kohloth
Copy link

kohloth commented Sep 21, 2023

I am having this same issue too. It seemed to start happening recently (I think) but downgrading the version number does not seem to have fixed the problem. These errors come up when moving the mouse over the code mirror input and when pressing keys inside of it. I've tried to see if I can make the error go away by simplifying my use of the component, but even after stripping it down to the bare minimum props (shown below) I still see these console errors.

My usage of the component (note that I've commented most props out - errors still occur)

	<CodeMirror
		ref={rootRef}
		// indentWithTab={false}
		// readOnly={usedReadOnly}
		className="code-input__input"
		// theme={theme}
		value={value}
		height="100%"
		// extensions={extensions}
		onChange={handleChange}
		// basicSetup={basicSetup}
	/>

Error is the same as the others have reported:

Screenshot from 2023-09-21 01-18-18

@jaywcjlove
Copy link
Member

@zjy365 @kohloth @liaoyingtao This is caused by the integrated crosshairCursor Extension. I have already set it to false by default.

Upgrading to v4.21.15 or using the following configuration can suppress the error caused by the crosshairCursor. The issue related to crosshairCursor needs to be resolved by the @codemirror team.

<CodeMirror 
  basicSetup={{
+   crosshairCursor: false
  }}
 />

@mojiAh
Copy link

mojiAh commented Sep 21, 2023

Had same issue, for now setting the crosshairCursor: false fixed the issue.

@zjy365
Copy link
Author

zjy365 commented Sep 22, 2023

@zjy365 @kohloth @liaoyingtao This is caused by the integrated crosshairCursor Extension. I have already set it to false by default.

Upgrading to v4.21.15 or using the following configuration can suppress the error caused by the crosshairCursor. The issue related to crosshairCursor needs to be resolved by the @codemirror team.

<CodeMirror 
  basicSetup={{
+   crosshairCursor: false
  }}
 />

Thank you. Successfully resolved

@zjy365 zjy365 closed this as completed Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants