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

Inspector: Can't get to owner of nested component if the owner only contains the component #545

Open
henrikvilhelmberglund opened this issue Dec 11, 2022 · 3 comments
Labels
bug Something isn't working edge-case

Comments

@henrikvilhelmberglund
Copy link

henrikvilhelmberglund commented Dec 11, 2022

Describe the bug

In the inspector I can't get to the owner of nested component when hovering if the owner only contains the component.

Maybe it's supposed to be like that but I would like to be able to get to the owning component because I had set props there (not showing that in the repro example though).

In my real project I see

<!--<P>-->
<!--<OwningComponent>-->

in the devtools element list but maybe the inspector doesn't use those?

Reproduction URL

https://stackblitz.com/edit/vitejs-vite-jwrile?file=src/lib/NestingP.svelte

Reproduction

  1. Click the inspector button.
  2. Hover over the text "I am nested". It takes you to P.svelte even though the text "I am nested" comes from NestingP.svelte
  3. Hover over the text "Unless I do something like this". It takes you to NestingP.svelte as expected because it has an element that is not another component.

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/vite-plugin-svelte: ^2.0.0 => 2.0.1 
    svelte: ^3.54.0 => 3.54.0 
    vite: ^4.0.0 => 4.0.0 

(... stackblitz)
@henrikvilhelmberglund henrikvilhelmberglund added bug Something isn't working triage Awaiting triage by a project member labels Dec 11, 2022
@dominikg
Copy link
Member

does using the up arrow for parent selection work for you? also see #531 (comment)

@henrikvilhelmberglund
Copy link
Author

No, it gives App.svelte instead of NestingP.svelte. So basically if there's a nested component but nothing else in the parent component it's not detected at all.

@dominikg
Copy link
Member

oh, in that case the component is not selectable with the current implementation of svelte-inspector.

The information which file/position to open is attached to dom nodes and svelte inspector finds them. No dom node, no find.

We could look into the possibility of scanning for comment nodes too but that could get tricky. Going to mark this as edge-case. It may ultimately need help from svelte compiler to get fixed.

@dominikg dominikg added edge-case and removed triage Awaiting triage by a project member labels Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working edge-case
Projects
None yet
Development

No branches or pull requests

2 participants