react-component-tree icon indicating copy to clipboard operation
react-component-tree copied to clipboard

Can't click on leaf nodes to open the corresponding code file

Open ADTC opened this issue 1 year ago • 4 comments

Describe the bug It seems I can only click on higher level nodes to open the corresponding code file, but this doesn't work on leaf nodes.

To Reproduce Steps to reproduce the behavior:

  1. Install Extension.
  2. Run it on a parent component.
  3. Click on leaf/non-leaf nodes in the tree.

Expected behavior Clicking on any node should open the corresponding code file

Screenshots

image

I'm only able to click on the first three (that is, the non-leaf nodes) to open the corresponding code file. If I click the last three (leaf nodes), nothing happens.

Additional context VS Code

Version: 1.88.1
Commit: e170252f762678dec6ca2cc69aba1570769a5d39
Date: 2024-04-10T17:43:08.196Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin arm64 23.4.0

ADTC avatar May 06 '24 14:05 ADTC

Upon further testing, it appears that this conks out specifically in a Next.js App Router project for one of two reasons:

  1. The component is a folder-based component (i.e. ComponentName/index.tsx, not ComponentName.tsx), in which case the node is selectable but nothing opens.

    The Extension Host output shows the error Unable to read file '/path/to/ComponentName' that is actually a directory.

  2. The component is imported via an alias set up in tsconfig.json (could be jsconfig.json too I suppose, but we're using Typescript).

        "paths": {
          "@/*": ["./*"],
        },
    
    import ComponentName from '@/components/ComponentName'
    

    In this case, the node is entirely not selectable at all.

ADTC avatar May 06 '24 14:05 ADTC

let me see if i can reproduce this

hb1998 avatar May 11 '24 07:05 hb1998

Any news? I have the same issue.

clickglue avatar Oct 19 '24 09:10 clickglue

Same, it's able to find all the components in the current file but nothing beyond that and all links are unclickable.

kerryj89 avatar Nov 14 '24 14:11 kerryj89