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 property 'superClass' of undefined #43

Closed
capaj opened this issue Nov 29, 2018 · 21 comments
Closed

TypeError: Cannot read property 'superClass' of undefined #43

capaj opened this issue Nov 29, 2018 · 21 comments
Labels

Comments

@capaj
Copy link

capaj commented Nov 29, 2018

https://github.com/wix/vscode-glean/blob/7d6791f9595bb9be4e5619f566c7c67276599d87/src/modules/jsx.ts#L166

I think that line needs another guard because I am seeing:

ERR Cannot read property 'superClass' of undefined: TypeError: Cannot read property 'superClass' of undefined
    at isSupportedComponent (/home/capaj/.vscode/extensions/wix.glean-4.2.3/out/modules/jsx.js:152:28)
    at Object.isStatefulComp (/home/capaj/.vscode/extensions/wix.glean-4.2.3/out/modules/jsx.js:158:9)
    at CompleteActionProvider.provideCodeActions (/home/capaj/.vscode/extensions/wix.glean-4.2.3/out/extension.js:33:19)
    at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:509:787
    at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:114:65
    at new Promise (<anonymous>)
    at Object.t.asThenable (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:114:33)
    at e.provideCodeActions (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:509:746)
    at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:524:308
    at e._withAdapter (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:520:234)
    at e.$provideCodeActions (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:524:270)
    at t._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:609:757)
    at t._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:609:423)
    at t._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:607:973)
    at t._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:606:957)
    at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:604:773
    at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:103:886
    at e.fire (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:105:344)
    at a (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:156:881)
    at Socket._socketDataListener (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:157:95)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)

The code I am looking at is just a simple stateless component.

Version 4.2.3

@borislit
Copy link
Contributor

borislit commented Dec 1, 2018

@capaj Wow ! first of all, thanks for the PR and the issue! Can you please post the snippet you've tried to refactor? Thanks!

@capaj
Copy link
Author

capaj commented Dec 2, 2018

I actually get this error whenever I focus any code at all. It doesn't even have to be a stateless component. I got it even with a bash script, with html template, with whatever you can think of.

@borislit
Copy link
Contributor

borislit commented Dec 2, 2018

I see. Does it happen when you select a valid component though? If so, can u post a snippet?

@eastcoastcoder
Copy link

Getting this problem as well. Downgraded to 4.2.2 just to to see if an older version helps. It gives the same error so I think it might either be a problem with a new VSCode update or a conflicting extension.

@petekp
Copy link

petekp commented Mar 29, 2019

Also getting this error with VSCode 1.32.3 during app startup / initial extension activation. Using TypeScript. Glean doesn't appear to load at all, at least the commands aren't available.

[2019-03-29 12:43:36.449] [exthost] [error] [wix.glean] provider FAILED
[2019-03-29 12:43:36.450] [exthost] [error] TypeError: Cannot read property 'superClass' of undefined
    at isSupportedComponent (/Users/petepetrash/.vscode/extensions/wix.glean-4.10.1/out/modules/stateful-to-stateless.js:303:28)
    at Object.isStatefulComp (/Users/petepetrash/.vscode/extensions/wix.glean-4.10.1/out/modules/stateful-to-stateless.js:310:9)
    at CompleteActionProvider.provideCodeActions (/Users/petepetrash/.vscode/extensions/wix.glean-4.10.1/out/extension.js:39:37)
    at define.provideCodeActions.a.asPromise (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:564:641)
    at t.asPromise.Promise (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:48:58)
    at new Promise (<anonymous>)
    at Object.t.asPromise (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:48:32)
    at I.provideCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:564:612)
    at define.$provideCodeActions._withAdapter.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:580:417)
    at $._withAdapter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:575:502)
    at $provideCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:580:395)
    at h._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:593:118)
    at h._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:592:777)
    at h._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:591:383)
    at h._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:590:279)
    at define.constructor._protocol.onMessage.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:588:565)
    at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43:254)
    at e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:39:64)
    at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43:254)
    at s (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:168:754)
    at Socket.define.constructor._socketDataListener.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:168:960)
    at Socket.emit (events.js:182:13)
    at Socket.EventEmitter.emit (domain.js:442:20)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20)
[2019-03-29 12:43:36.725] [exthost] [info] ExtensionService#_doActivateExtension vscode.extension-editing {"startup":false,"activationEvent":"onLanguage:typescript"}
[2019-03-29 12:43:36.725] [exthost] [info] ExtensionService#loadCommonJSModule /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/extension-editing/dist/extension

@borislit
Copy link
Contributor

borislit commented Apr 1, 2019

Hey @petekp , can you post the snipper u've tried refactoring?

@petekp
Copy link

petekp commented Apr 1, 2019

@borislit I'm unable to use the plugin — the commands aren't accessible / don't show up since the plugin doesn't appear to load when my extensions are activated.

@borislit
Copy link
Contributor

borislit commented Apr 1, 2019

@petekp hmmm odd. Can you post the React snipper u've tried to refactor?

@TimCluyts
Copy link
Contributor

Having the same issue here on React memo's

const Rows = memo(({ customer }) => { return <span>some layout stuff</span> }

[renderer1] [error] Cannot read property 'superClass' of undefined: TypeError: Cannot read property 'superClass' of undefined

@borislit
Copy link
Contributor

borislit commented Apr 9, 2019

@TimCluyts You are getting this error when You select the snippet?

@TimCluyts
Copy link
Contributor

@borislit When I put my cursor on memo, but even when I just open the file itself.
Additionally I get following error too:

[2019-04-09 10:25:57.544] [exthost] [error] TypeError: Cannot read property 'selection' of undefined at Object.selectedText (c:\Users\****\.vscode\extensions\wix.glean-4.10.1\out\editor.js:37:30) at CompleteActionProvider.provideCodeActions (c:\Users\****\.vscode\extensions\wix.glean-4.10.1\out\extension.js:17:31) at define.provideCodeActions.a.asPromise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:587:847) at t.asPromise.Promise (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:49:430) at new Promise (<anonymous>)

This is just on top of the superclass of undefined

@borislit
Copy link
Contributor

borislit commented Apr 9, 2019

@TimCluyts Ok, I can reproduce! The fix is on its way :)

borislit pushed a commit that referenced this issue Apr 9, 2019
## [4.10.2](v4.10.1...v4.10.2) (2019-04-09)

### Bug Fixes

* **stateful-to-stateless:** Fixes [#43](#43) ([6d12723](6d12723))
@borislit
Copy link
Contributor

borislit commented Apr 9, 2019

🎉 This issue has been resolved in version 4.10.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@borislit
Copy link
Contributor

borislit commented Apr 9, 2019

@TimCluyts can you verify the issue is resolved?
Also, full credit for the fix goes to @capaj ! My bad I haven't merged this earlier!

@borislit
Copy link
Contributor

borislit commented Apr 9, 2019

@TimCluyts BTW, What refactoring did you try to perform on the memo component? Perhaps its something we should support

@TimCluyts
Copy link
Contributor

The issue on "superclass" has indeed been resolved. But - if you open the output window (Extension host) - and go to a memo class and put your cursor on "memo" it will still give the following:
image

For that last question, the thing is that I did not in fact try to refactor. It just ended up in de output window when opening the file or selecting the memo itself.
I only actually stumbled upon this issue because I was fighting with another one of my extensions and then, when enabling only Glean, I noticed these issues.

@TimCluyts
Copy link
Contributor

I just created a fix for the issue described above.

@TimCluyts
Copy link
Contributor

@borislit any chance of merging it? I am having to disable Glean because of these issues.

@borislit
Copy link
Contributor

@TimCluyts Sure. Ill review and merge right away

@TimCluyts
Copy link
Contributor

@borislit #66

@borislit
Copy link
Contributor

@TimCluyts Done! Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants