Skip to content

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

Merged
alexdima merged 5 commits intomicrosoft:mainfrom
felixlheureux:reset-value-when-undefined-or-null
Nov 16, 2022
Merged

Reset value to an empty string when undefined or null#165721
alexdima merged 5 commits intomicrosoft:mainfrom
felixlheureux:reset-value-when-undefined-or-null

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.

@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.

5 participants