Skip to content

feat(logs): add in-memory message buffer for offline queueing#241

Merged
antfu merged 2 commits intomainfrom
antfu/logs-client-msg-buffer
Mar 23, 2026
Merged

feat(logs): add in-memory message buffer for offline queueing#241
antfu merged 2 commits intomainfrom
antfu/logs-client-msg-buffer

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented Mar 23, 2026

Description

Adds an in-memory buffer to the logs client that queues add/remove/clear operations when the RPC client is not yet authorized or connected. Operations are flushed in FIFO order once the client becomes trusted.

The add method returns a proxy handle immediately with placeholder data, which is swapped for the real server entry after the buffered operation flushes. Handle methods (update/dismiss) automatically wait for the real handle to resolve.

The clear operation clears preceding buffered operations as an optimization, since they would be cleared anyway.

Linked Issues

N/A

Additional context

  • Fast path: trusted + empty buffer → direct RPC call (zero overhead)
  • Deferred promise pattern: handle methods use ready.then() instead of manual callback queuing
  • Pattern consistency: follows existing trust-deferral patterns in rpc-shared-state.ts

antfu and others added 2 commits March 23, 2026 11:42
Queue add/remove/clear operations when the client is not yet authorized
or connected, then flush them in FIFO order once the RPC connection
becomes trusted. The add method returns a proxy handle immediately with
placeholder data, swapping in the real server entry after flush. Includes
optimization to discard pending operations when clear is called.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 23, 2026

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@241

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@241

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@241

@vitejs/devtools-rpc

npm i https://pkg.pr.new/@vitejs/devtools-rpc@241

@vitejs/devtools-self-inspect

npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@241

commit: 8490851

@antfu antfu merged commit 9f5403c into main Mar 23, 2026
9 checks passed
@antfu antfu deleted the antfu/logs-client-msg-buffer branch March 23, 2026 02:56
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