You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed the component tree to derive state from fiber nodes directly instead of DOM nodes with refs to fiber nodes. This change allows the component tree to include components that don't render any host elements (DOM nodes).
6
+
7
+
## Changes Made
8
+
9
+
### 1. Updated `getInspectableElements` in `utils.ts`
10
+
-**Before**: Traversed DOM elements using `element.children` and `element.parentElement`
11
+
-**After**: Traverses fiber tree using `fiber.child`, `fiber.sibling`, and `fiber.return`
12
+
-**Key improvement**: Now includes components that don't render DOM elements (e.g., components that only return other components or null)
13
+
14
+
### 2. Updated `buildTreeFromElements` in `components-tree/index.tsx`
15
+
-**Before**: Built tree hierarchy based on DOM element parent-child relationships
16
+
-**After**: Built tree hierarchy based on fiber parent-child relationships using `fiber.return`
17
+
-**Key improvement**: Tree structure now accurately reflects React component hierarchy, not DOM hierarchy
18
+
19
+
### 3. Updated Interface Definitions
20
+
-**`InspectableElement.element`**: Changed from `HTMLElement` to `HTMLElement | null`
21
+
-**`TreeNode.element`**: Changed from optional `HTMLElement` to optional `HTMLElement | null`
22
+
23
+
### 4. Updated Selection Logic
24
+
-**Before**: Compared DOM elements to determine selection (`node.element === focusedDomElement`)
The implementation compiles with minor TypeScript configuration issues (unrelated to the core logic). The fiber-based traversal correctly identifies and includes all composite components, including those that don't render DOM elements.
0 commit comments