Skip to content

feat(data-inspector): inline sources, lazy deep-node expansion, auto-rerun, playground toolbar#111

Merged
antfu merged 4 commits into
mainfrom
eighty-parks-accept
Jul 17, 2026
Merged

feat(data-inspector): inline sources, lazy deep-node expansion, auto-rerun, playground toolbar#111
antfu merged 4 commits into
mainfrom
eighty-parks-accept

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Four enhancements to the data-inspector plugin, all in one branch.

1. exposeDataInspector accepts data sources

A new sources?: DataSourceEntry[] option registers sources before the endpoint opens — a convenience over calling registerDataSource yourself. Both paths share the one process-global registry, so inline and separately-registered sources coexist.

2. Lazy expansion of deep nodes

Large graphs no longer arrive all at once. The normalizer records a structural NodePath on every depth-truncation marker; a new queryPath RPC re-runs the base query, re-descends to that node, and returns just its subtree normalized with a fresh depth budget. In the viewer, a depth-capped node renders a load deeper link that fetches the subtree on demand and splices it in place (recursively — nested markers carry absolute paths). Navigation mirrors the normalizer exactly (arrays re-apply excludeFunctions, Maps/Sets handled), so a lazily fetched slice lines up with what is on screen.

3. Auto rerun

An optional poller under the filters — auto rerun every N seconds (checkbox + numeric seconds, default 5) — re-runs the current query against the live object on a fixed period, so a value that changes over time updates on its own. It persists in the URL (and restores an already-on toggle on load), and skips a tick while a run is in flight or the query is syntactically broken.

4. Playground-style toolbar

The query/result surfaces gain the affordances of the discovery jora playground, built with the shared @antfu/design components: copy-query, and expand-all / collapse-all / copy-as-JSON over the results.

Verification

  • New engine unit tests cover navigate, runQueryAtPath, and the $path marker (filters, Set/Map steps, soft-fail).
  • Smoke-tested in a browser against a static export of a 14-level-deep dataset: load deeper fetches and splices subtrees, auto-rerun restores from the URL and polls live, and the toolbar buttons work.
  • pnpm lint && pnpm test && pnpm typecheck && pnpm build all green (743 tests); API snapshots regenerated.

This PR was created with the help of an agent.

…rerun, playground toolbar

- exposeDataInspector accepts a sources[] option, registering them before the
  endpoint opens (a convenience over calling registerDataSource separately)
- lazy-expand depth-truncated nodes: the normalizer records a NodePath on each
  depth marker, a new queryPath RPC re-runs the query and returns a fresh slice
  of that subtree, and the viewer splices it in below a 'load deeper' link
- auto rerun: an optional poller under the filters re-runs the query every N
  seconds against the live object; persisted in the URL, skipped while a run is
  in flight or the query is broken
- richer result/query toolbar: copy query, expand-all/collapse-all, copy JSON
@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit fd5e238
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a59fe8ba53e530009cecb46
😎 Deploy Preview https://deploy-preview-111--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

antfubot and others added 3 commits July 17, 2026 09:04
… TimeAgo, themed tooltips

- auto-rerun pauses while the tab is backgrounded (Page Visibility) and resumes
  with an immediate catch-up run when it returns to the foreground
- status bar shows a live 'ran … ago' label (@antfu/design DisplayDate) tracking
  the last successful query
- tooltips use @antfu/design's themed floating-vue stylesheet so they follow the
  design tokens (surface, border, light/dark) instead of the default look
The zero-code `--import` agent has nowhere to call registerDataSource, so it now
auto-registers a `globalThis` source (createGlobalThisDataSource) — assigning to
the global object is enough to inspect anything. Opt out with
DEVFRAME_DATA_INSPECTOR_GLOBAL=0. Docs updated with the workflow.
@antfu
antfu merged commit df403b2 into main Jul 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants