-
Notifications
You must be signed in to change notification settings - Fork 518
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(playground): support state param in playground #12168
Conversation
Bundle StatsHey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
client/src/playground/index.tsx
Outdated
} else if (stateParam) { | ||
try { | ||
let { state } = await decompressFromBase64(stateParam); | ||
console.log(state); |
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.
console.log(state); |
client/src/playground/index.tsx
Outdated
let { state } = await decompressFromBase64(stateParam); | ||
console.log(state); | ||
let code = JSON.parse(state || "{}") as EditorContent; | ||
console.log(code); |
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.
console.log(code); |
return bytes.buffer; | ||
} | ||
|
||
export async function decompressFromBase64(base64String: string) { |
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.
Looks like the only difference between this and the function in libs/play/index.js
is the use of the above base64ToBytes
instead of Buffer.from
- which I presume is a node built in. But could we move the above function into libs/play/index.js
as well and use this code in node as well? It would be nice to use the same code in both places.
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.
Ah, it's a bit of a pain isn't it - would need to extract the node specific bits into another file in the lib - the current form is ok
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.
I agree in principal. But I'd want to look at this a bit deeper. The base64ToBytes
is rather inefficient, and that's probably one the expensive paths in the cloud function. I'll add a task to investigate but wouldn't block on this.
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.
tested locally, looks good!
Summary
Not actively used except for the open in playground button on full screen live samples
Problem
open in playground button brings the user to an empty playground.
Solution
Load the content into the playground.
How did you test this change?
locally