Skip to content

fix(kit): read client context from the hub's global slot - #649

Open
lishaduck wants to merge 1 commit into
vitejs:mainfrom
lishaduck:fix/kit-client-context-hub-slot
Open

lishaduck wants to merge 1 commit into
vitejs:mainfrom
lishaduck:fix/kit-client-context-hub-slot

Conversation

@lishaduck

Copy link
Copy Markdown

Description

getDevToolsClientContext() always returned undefined because nothing has written __VITE_DEVTOOLS_CLIENT_CONTEXT__ since #529 moved to the @devframes/hub-ui client, so it now reads the hub's client context and CLIENT_CONTEXT_KEY re-exports the hub's key.

Linked Issues

Additional context

tsnapi reports CLIENT_CONTEXT_KEY as narrowed (string to the hub's literal key), so the snapshot was updated with TSNAPI_ALLOW_BREAKING=1.

getDevToolsClientContext() read __VITE_DEVTOOLS_CLIENT_CONTEXT__, whose only
writers were core's own embedded and standalone clients. Those were removed
when core adopted the @devframes/hub-ui client (vitejs#529), which publishes the
context through setDevframeClientContext at __DEVFRAME_HUB_CLIENT_CONTEXT__,
so the getter always returned undefined.

Delegate to getDevframeClientContext and re-export the hub's
CLIENT_CONTEXT_KEY so the exported key names the slot that is written.

Amp-Thread-ID: https://ampcode.com/threads/T-01a21105-bd16-7037-8fd4-6d70cea7c088
Co-authored-by: Amp <amp@ampcode.com>
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