-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(preview): consume client #425
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7b4c3f8:
|
Size changessandpack-react
Details
sandpack-client
Details
|
96b2f80
to
efa32a7
Compare
Sweet yeah, this looks like it'll work for what i intend to do. Thanks for the quick turnaround! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope the changes make sense. Good job Danilo
Co-authored-by: Roman Kuba <[email protected]>
Co-authored-by: Roman Kuba <[email protected]>
Co-authored-by: Roman Kuba <[email protected]>
Open in CodeSandbox Web Editor | VS Code
Imperatively retrieve the Sandpack client from a SandpackPreview:
I agree that currently there is no way to get the current client id and the client instance from a preview component, and it might be too restrictive for a few cases. Although we already have available the list of all clients, currently I can't see a way to link a client from the list to a component, so hope that this new API makes it possible now.
Worth mentioning, that the SandpackClient will not be instantly available. Sandpack has its own rules to decide what is the "right" moment to initialize a SandpackClient from a preview component (autoron, initMode, client stack), which means that it's expected that
getClient
might return undefined and it's a valid state.TODO
Solves #423 @malerba118 does it make sense for you?