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

Reset value to an empty string when undefined or null #165721

Merged

Conversation

felixlheureux
Copy link
Contributor

@felixlheureux felixlheureux commented Nov 7, 2022

Undefined and null values are not properly handled. When an undefined value is passed in Monaco, the textModel will call factory.create on an undefined value which will throw an undefined error.

Also, if a null value is passed, since the logic returns without updating the value, the previous data will still be displayed.

A solution is to reset the value to an empty string.

Issue: microsoft/monaco-editor#3414

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. The fix should be to throw when an invalid argument is passed in.

src/vs/editor/common/model/textModel.ts Outdated Show resolved Hide resolved
@alexdima alexdima added this to the November 2022 milestone Nov 16, 2022
@alexdima alexdima merged commit 3444a91 into microsoft:main Nov 16, 2022
@alexdima
Copy link
Member

Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants