fix(devtools): restore plugin marketplace and harden event bus connection#466
Conversation
…tion
The plugin marketplace rendered empty ("No additional plugins available")
because the `mounted` -> `package-json-read` round-trip could be lost:
- ClientEventBus.emitToServer silently dropped events emitted while the
WebSocket was still connecting. They are now buffered and flushed once the
socket opens.
- The marketplace re-requests package.json on every open and retries until it
arrives, so re-opening always re-fetches the plugin list.
- The basic React example reconnects to the server bus (connectToServerBus).
- Added TanStack AI Devtools to the plugin marketplace registry.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds WebSocket connecting-state event buffering to the client event bus so events emitted during ChangesMarketplace Reliability Fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 6c19402
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/angular-devtools
@tanstack/devtools
@tanstack/devtools-a11y
@tanstack/devtools-client
@tanstack/devtools-ui
@tanstack/devtools-utils
@tanstack/devtools-vite
@tanstack/devtools-event-bus
@tanstack/devtools-event-client
@tanstack/preact-devtools
@tanstack/react-devtools
@tanstack/solid-devtools
@tanstack/vue-devtools
commit: |
Problem
Opening the devtools and clicking the marketplace ("Add More") showed an empty panel with "No additional plugins available. You have all compatible devtools installed and registered!", even when installable plugins exist.
Root cause
The marketplace's plugin list is populated by a single
mounted→package-json-readround-trip over the event bus. That round-trip could be lost in two ways:ClientEventBus.emitToServeronly sent over the WebSocket whenreadyState === OPEN. TheEventClientconsiders itself "connected" after a synchronous handshake with theClientEventBus, but the bus's WebSocket to the server can still be inCONNECTING. Any event emitted in that window (including the marketplace'smounted) was dropped with no queue and no retry, sopackage-json-readnever came back andcurrentPackageJsonstayednull→ empty marketplace.mountedexactly once inonMount, so a missed response was never recovered.(The basic React example had also lost its
eventBusConfig={{ connectToServerBus: true }}in #419, so it never connected to the server bus at all.)Changes
@tanstack/devtools-event-bus—ClientEventBusnow buffers events emitted while the WebSocket isCONNECTINGand flushes them in order once it opens (cleared on close/stop). No early event is silently dropped. Added unit tests covering queue-while-connecting, flush-on-open, send-when-open, and drop-on-close-before-open.@tanstack/devtools— the marketplace re-requestspackage.jsonevery time it opens and retries (≤10 × 400ms) until the data arrives, then stops. Re-opening always re-fetches the plugin list.@tanstack/devtools— added TanStack AI Devtools (@tanstack/react-ai-devtools, plugin idtanstack-ai) to the marketplace registry.examples/react/basicreconnects to the server bus viaconnectToServerBus: true.Testing
@tanstack/devtools-event-busunit tests pass (56 incl. 3 new).mountedemit per open, retry loop dormant once data arrives, 0 console errors.Release
Includes a changeset patch-bumping all publishable packages.
Summary by CodeRabbit
New Features
Bug Fixes
Tests