mirror of
https://github.com/block/buzz.git
synced 2026-11-13 21:01:53 +00:00
Clicking into a channel could leave the pane blank, with the console
showing:
[tiptap error]: The editor view is not available.
Cannot access view['dom']. The editor may not be mounted yet.
That string is a *thrown* Error, not a warning. Tiptap v3 returns a Proxy
from `editor.view` before the ProseMirror view is mounted, and the Proxy's
`get` trap throws for any key absent from its small target — including
`dom`.
`SelectionFormattingTray` read `editor.view.dom` directly inside a
`React.useEffect`. That effect runs on the same commit that mounts
`EditorContent`, so on a freshly mounted composer the view can still be
absent; the throw escaped the effect and React tore down the surrounding
subtree, which is why navigating into a channel appeared to do nothing.
Guard the access and retry on the next frame until the view exists,
matching the existing convention in the sibling hook
`useComposerSpoilerParticles`, which already wraps the same access in
try/catch with a rAF retry. Subscriptions now attach once the view is
real, and teardown cancels a pending retry as well as detaching
listeners.
Added `SelectionFormattingTrayUnmountedView.test.mjs`, which renders the
real component against a fake editor whose `view` reproduces Tiptap's
throwing Proxy (on a prototype getter, as the real `Editor` has it) and
then mounts on a later frame. Verified the two new mount tests fail
against `origin/main` with the exact error string above and pass with
this change.
Testing: `pnpm check`, `pnpm typecheck`, and `pnpm test`
(5455 passing, 0 failing).
Co-authored-by: Michael Neale <michael.neale@gmail.com>
Signed-off-by: Michael Neale <michael.neale@gmail.com>
Buzz
Desktop chat shell with:
- Tauri + React + TypeScript + Vite
- Tailwind CSS
- shadcn/ui-ready shared components
- Biome (lint/format/check)
- Feature-driven frontend structure
Scripts
pnpm dev- run the web frontendpnpm tauri dev- run the desktop apppnpm build- typecheck and build frontendpnpm typecheck- TypeScript checkspnpm lint- Biome lintpnpm format- Biome format (write)pnpm check- Biome check
Structure
src/shared- reusable app-wide code (ui,lib,styles)src/features- feature modules (vertical slices)src/app- top-level app composition