Skip to content

Commit 696afa9

Browse files
committed
feat: add stickyPathHeaders prop to ObjectView and update documentation
1 parent ef3d287 commit 696afa9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

API_DOCUMENTATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export type ObjectViewProps = {
4343
arrayGroupSize?: number;
4444
resolver?: Map<any, ResolverFn>;
4545
highlightUpdate?: boolean;
46+
stickyPathHeaders?: boolean;
4647
preview?: boolean;
4748
nonEnumerable?: boolean;
4849
includeSymbols?: boolean;
@@ -64,6 +65,7 @@ export type ObjectViewProps = {
6465
| `arrayGroupSize` | `0` | When greater than `1`, adds an array grouping resolver that presents ranges like `[0…49]`. |
6566
| `resolver` | `undefined` | Custom resolver map merged on top of the built-in resolver map. Keys are constructors; values are `ResolverFn`s. |
6667
| `highlightUpdate` | `false` | Enables flash-highlighting when a node's value changes. |
68+
| `stickyPathHeaders` | `true` | Keeps the current ancestor row pinned to the top of the viewport while its children scroll; set to `false` for legacy, non-sticky behaviour. |
6769
| `preview` | `true` | Shows inline previews (e.g. `Array(10)` or string snippets) for collapsed nodes. |
6870
| `nonEnumerable` | `false` | Includes non-enumerable properties when traversing objects. |
6971
| `includeSymbols` | `false` | Includes symbol-keyed properties during traversal and in previews. |

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ React Object View targets React 19 projects (Node 22+ / Yarn 4 recommended) and
1212
## ✨ Features
1313

1414
- **Virtualized tree view** – only visible rows render, so 100k+ nodes stay smooth.
15+
- **Sticky path headers** – pin ancestor rows while scrolling so nested contexts stay visible.
1516
- **Resolver system** – promises, maps, sets, errors, dates, regexes, iterables, grouped proxies, and custom classes.
1617
- **Lazy `valueGetter`** – keeps data fresh without forcing heavy re-renders.
1718
- **Grouping for huge payloads**`arrayGroupSize` & `objectGroupSize` bucket massive collections (objects must be enumerated first—see note below).
@@ -76,6 +77,7 @@ Wrap dynamic data in `useMemo`/`useCallback` so the virtual tree only re-walks w
7677
| `arrayGroupSize` | `number` | `0` | Splits very large arrays into range buckets (`[0…999]`) for faster navigation. |
7778
| `resolver` | `Map<any, ResolverFn>` | `undefined` | Merge in custom resolvers keyed by constructor. |
7879
| `highlightUpdate` | `boolean` | `false` | Flash updated values via `useChangeFlashClasses`. |
80+
| `stickyPathHeaders` | `boolean` | `true` | Pins the current node's ancestor label while you scroll through its children; disable to revert to free-scrolling rows. |
7981
| `preview` | `boolean` | `true` | Show inline previews (`Array(5)`, `'abc…'`) on collapsed rows. |
8082
| `nonEnumerable` | `boolean` | `false` | Include non-enumerable properties during traversal. |
8183
| `includeSymbols` | `boolean` | `false` | Include symbol keys when enumerating or previewing objects. |

USAGE_GUIDE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ return (
192192
);
193193
```
194194

195+
### Sticky Path Headers
196+
197+
Deeply nested trees can feel disorienting because the parent context scrolls away. Leave `stickyPathHeaders` enabled (default) to pin the current ancestor row while you browse its children, or flip it off when you prefer pure free-flow scrolling:
198+
199+
```tsx
200+
<ObjectView
201+
valueGetter={counterGetter}
202+
expandLevel={2}
203+
stickyPathHeaders={false} // opt out of the pinning behaviour
204+
/>
205+
```
206+
207+
Use this prop when embedding the viewer inside panels with their own sticky headers so you can decide which element controls the vertical stacking order.
208+
195209
### Line Numbers & Layout Tweaks
196210

197211
Control how each row is rendered and surfaced:

0 commit comments

Comments
 (0)