Skip to content

Optional NextGraph mirror, as one imported component - #1360

Open
joepio wants to merge 1 commit into
developfrom
ng-bridge
Open

Optional NextGraph mirror, as one imported component#1360
joepio wants to merge 1 commit into
developfrom
ng-bridge

Conversation

@joepio

@joepio joepio commented Sep 4, 2026

Copy link
Copy Markdown
Member

Adds @tomic/ng-bridge-react (from the sibling atomic-ng-bridge repo) and mounts its badge next to the router, plus its panel on the Sync page. That component mirrors the current local-only drive into a NextGraph document, live, with no AtomicServer in the loop.

Deliberately the whole footprint in this repo: every piece of NextGraph code lives in the imported package. It renders nothing, and loads nothing, unless enabled with ?ngbridge=1. Dropping the mirror is reverting this commit.

Vite needs three things for it, each found by running it rather than reading:

  • worker.plugins applies vite-plugin-wasm to worker builds. It does not inherit from the main plugin array, and without it the worker fails to build and the mirror silently falls back to running its wasm on the main thread, where a long query competes with rendering.
  • server.fs.allow includes the mirror's checkout when it is linked from a sibling directory. Vite serves the worker entry over /@fs/ as its own request and refuses paths outside the workspace root, so the worker 403s. Installed from a registry it lives in node_modules and none of this applies.
  • @ng-org/lib-wasm joins optimizeDeps.exclude, for the reason this file already documents for loro-crdt: a wasm dep that esbuild prebundles has its init hang forever rather than fail.

All three are inert when the mirror is not enabled.

Related Issues

closes #number

Checklist

  • Add changelog entry linking to issue, describe API changes
  • Add or update tests if needed
  • Update docs if needed

Adds @tomic/ng-bridge-react (from the sibling atomic-ng-bridge repo) and mounts
its badge next to the router, plus its panel on the Sync page. That component
mirrors the current local-only drive into a NextGraph document, live, with no
AtomicServer in the loop.

Deliberately the whole footprint in this repo: every piece of NextGraph code
lives in the imported package. It renders nothing, and loads nothing, unless
enabled with `?ngbridge=1`. Dropping the mirror is reverting this commit.

Vite needs three things for it, each found by running it rather than reading:

- `worker.plugins` applies `vite-plugin-wasm` to worker builds. It does not
  inherit from the main plugin array, and without it the worker fails to
  build and the mirror silently falls back to running its wasm on the main
  thread, where a long query competes with rendering.
- `server.fs.allow` includes the mirror's checkout when it is linked from a
  sibling directory. Vite serves the worker entry over `/@fs/` as its own
  request and refuses paths outside the workspace root, so the worker 403s.
  Installed from a registry it lives in node_modules and none of this applies.
- `@ng-org/lib-wasm` joins `optimizeDeps.exclude`, for the reason this file
  already documents for loro-crdt: a wasm dep that esbuild prebundles has
  its init hang forever rather than fail.

All three are inert when the mirror is not enabled.
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.

1 participant