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

Preferences: Render node only if present in schema #9313

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Apr 7, 2021

What it does

Fixes #9241 by not attempting to render a node in the PreferencesEditorWidget if we can't retrieve any information about that preference from the PreferenceService.

How to test

  1. Install the plugins described TypeError: Cannot read property 'defaultValue' of undefined when uninstalling a VS Code extension #9241.
  2. Uninstall them using the Extensions widget.
  3. You should see no errors in the console about attempts to access fields on an undefined variable.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work added the preferences issues related to preferences label Apr 7, 2021
@colin-grant-work
Copy link
Contributor Author

colin-grant-work commented Apr 7, 2021

@kittaakos, as I say in the description, the first commit should be enough to fix the error you observed. The second commit has more to do with cleaning up some pretty funky code from the implementation of the preferences widget. It's a lot of changes though, so happy to go with the narrower bugfix, if that seems more appropriate.

I decided just to go with the minimal fix, for now.

@colin-grant-work colin-grant-work force-pushed the bugfix/preference-renderer-cleanup branch from eb2e897 to edf8e61 Compare April 12, 2021 14:39
@colin-grant-work colin-grant-work force-pushed the bugfix/preference-renderer-cleanup branch from edf8e61 to c40df5b Compare April 12, 2021 14:43
@colin-grant-work colin-grant-work changed the title Preferences: Renderer Cleanup Preferences: Render node only if present in schema Apr 19, 2021
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirmed that it fixes the error reported in #9241.
I no longer see the following error, and the preferences-view is correctly updated on uninstall:

single-preference-wrapper.tsx:79 Uncaught TypeError: Cannot read property 'defaultValue' of undefined
    at SinglePreferenceWrapper.push.../../packages/preferences/lib/browser/views/components/single-preference-wrapper.js.SinglePreferenceWrapper.render (single-preference-wrapper.tsx:79)
    at finishClassComponent (react-dom.development.js:17160)
    at updateClassComponent (react-dom.development.js:17110)
    at beginWork (react-dom.development.js:18620)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at beginWork$1 (react-dom.development.js:23203)
    at performUnitOfWork (react-dom.development.js:22157)
    at workLoopSync (react-dom.development.js:22130)

@colin-grant-work colin-grant-work merged commit 924115c into eclipse-theia:master Apr 22, 2021
@colin-grant-work colin-grant-work deleted the bugfix/preference-renderer-cleanup branch April 22, 2021 14:14
@vince-fugnitto vince-fugnitto added this to the 1.13.0 milestone Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preferences issues related to preferences
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'defaultValue' of undefined when uninstalling a VS Code extension
2 participants