Matsuuu / web-component-devtools

Web Component DevTools is a Browser Extension enhancing the development experience of Web Component developers
https://matsuuu.github.io/web-component-devtools/
MIT License
131 stars 3 forks source link

[BUG]: TypeError: Cannot read properties of undefined (reading 'startsWith') #50

Closed herberthobregon closed 2 years ago

herberthobregon commented 2 years ago

Describe the bug in file crawler-inyect.js in the method sortFields Cannot read properties of undefined (reading 'startsWith')

If I debug the extension, effectively does not have the name property, missing login-needed EventName

image

the WC have this JSDoc

/**
 * ## `ct-router`
 * It's a simple routing system that changes the viewport depending on the route given
 *
 * @element ct-router
 * @event login-needed It triggers when a page requires authentication but the user is not yet logged in
 * @event loading It fires when a page is imported diamicamente and it is fired again when it finishes loading the page
 * @event location-changed it shoots when the route changes
 * @event error-import it fires when the page is not found
 */
@customElement('ct-router')
export class CtRouter extends LitElement {
}

in the code I fire this event with this

let ce = new CustomEvent('login-needed', {
    detail: { path: window.location.pathname }
});
this.dispatchEvent(ce);
window.dispatchEvent(ce);

I call this event differently from other events. I think this is the problem in general

Desktop (please complete the following information):

$ npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers
 System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 23.75 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.4.2 - ~/.nvm/versions/node/v16.4.2/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v16.4.2/bin/yarn
    npm: 7.18.1 - ~/.nvm/versions/node/v16.4.2/bin/npm
  Browsers:
    Brave Browser: 95.1.31.87
    Chrome: 95.0.4638.69
    Firefox: 92.0
    Safari: 14.1.2
  npmPackages:
    vite: ^2.5.3 => 2.6.11 
Matsuuu commented 2 years ago

Heya @herberthobregon

Thanks for the thorough bug report!

Sorry for the inconvenience with this version. I realised a week ago that I shipped this bug with the previous version. This is fixed in the upstream main https://github.com/Matsuuu/web-component-devtools/commit/09a75d58f92bff081281bdf54a03b11b86a07105 but not released as a new version yet.

I'll try to look into releasing a new version today that fixes this and some other stuff :)

Matsuuu commented 2 years ago

I've submitted 0.1.13 to review. It should ship on firefox today and Chrome in the following days :)

Sorry for the delay, Life's been busy