Open Sahil-958 opened 1 month ago
So it sounds like for our use case here there really is no downside to changing them to sandboxes instead of devboxes? Is that correct?
So it sounds like for our use case here there really is no downside to changing them to sandboxes instead of devboxes? Is that correct?
Yes and no.
For simpler embeds, switching to sandboxes works perfectly. However, for more complex embeds that require a full VM environment to run, it's not feasible. In those cases, we have to stick with devboxes or explore alternatives like StackBlitz, which also provides clean embeds without causing similar issues.
👍 well I'm in favor of us at least doing it where we can. Thanks for making this issue!
This issue is stale because it has had no activity for the last 30 days.
Checks
Describe your suggestion
Throughout the curriculum, there are interactive devboxes embedded from codesandbox.io, but they present several issues:
Initial Potentially Outdated Assumption
My understanding was that this issue exists because we're not using proper embed methods. Instead, we are embedding the full codesandbox.io devboxes inside iframes. I initially thought the root cause was the `embed=1` URL parameter not functioning as intended. This results in: - Cookie permission prompts. - A less responsive interface, unsuitable for the constrained space of an embed. - A requirement to sign in to clone the devbox in order to make edits. For comparison, here are two examples highlighting the difference between a properly embedded sandbox and one displayed in an iframe: - [Embed in an article](https://www.developerway.com/posts/intro-to-css-animations-for-react-devs) - [Devbox embedded using an iframe](https://www.theodinproject.com/lessons/react-new-introduction-to-state) Here are the above embed links opened in standalone tabs: - [Standalone Embed](https://codesandbox.io/embed/46mmq7?codemirror=1&hidedevtools=0&view=preview) - [Standalone Framed devbox](https://codesandbox.io/p/devbox/unruffled-pasteur-6h36wf?embed=1) The issue initially seemed to be related to the use of the `embed=1` URL parameter. For more context, here’s the information shared by @xandora on Discord, including code snippets showing the difference between our devbox embeds and the more structured article embeds: **Our embed:** ```html ``` **Article embed:** ```html ``` As you can see, the URLs differ significantly. In our case, we rely on URL parameters to specify it as an embed, while the article examples use a dedicated path (`/embed/embedID`), suggesting a more structured approach to embedding.Updated Findings
Upon reviewing the documentation on codesandbox.io, I discovered important distinctions between the two types of embeds:
Type 1: Devboxes
Type 2: Sandboxes
Migration Consideration
A key question is whether it's possible to convert a devbox into a sandbox.
The documentation doesn’t provide a clear answer, but given the difference in runtimes, we can assume that for complex projects, a sandbox might not be suitable. However, for simpler projects, using a sandbox could resolve these issues.
One important limitation: sandboxes cannot be used for projects that require bundlers like Vite. However, for simple React apps, sandboxes appear to be a viable solution.
Path
Foundations, Ruby / Rails, Node / JS, Other / NA
Lesson Url
The lesson URLs will be added after consulting with the community to identify all the Codesandbox embeds across various paths.
(Optional) Discord Name
saw_hill
(Optional) Additional Comments
A special thanks to @Eduardo06sp for the initial support and for recommending that this issue be raised on the curriculum GitHub repository.