Skip to content

Conversation

@snowystinger
Copy link
Member

Closes

Unauthenticated users cannot create a devbox, this attempts to create it and then provide a better error message if the creation of the sandbox failed.
I haven't figured out the happy path quite yet.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Dec 3, 2025

Comment on lines 168 to 169
ToastQueue.negative('Failed to create CodeSandbox, make sure you are logged in to CodeSandbox. If you are already logged in, logout and log back in.');
}
Copy link
Member

@reidbarber reidbarber Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of like the idea of this being a Dialog. It's less harsh and there's more room to to explain what the user needs to do. And the primary action could do another check (with pending state) and open the link if it passes.

Copy link
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! One comment

@snowystinger
Copy link
Member Author

This appears to be a non-viable solution. When we use the form approach the users authentication cookies are included because it's the same domain.

When I try to use the fetch, I can't include the auth because it's cross-origin.

I could try loading an hidden iframe of codesandbox potentially and if it loads vs errors, we might be able to determine if the user is logged in, but even that may not work. I think we should provide more info in a dialog that opens to confirm that you mean to leave the page though, that's the simplest solution, though does require one more click.

@snowystinger snowystinger reopened this Dec 4, 2025
@snowystinger snowystinger marked this pull request as ready for review December 4, 2025 04:34
@rspbot
Copy link

rspbot commented Dec 5, 2025

{({close}) => (<>
<Heading slot="title">Create a CodeSandbox</Heading>
<Content>
<p>This will open a new tab with a CodeSandbox containing this example. If you see a 403 error, please log in to CodeSandbox and try again. If you are already logged in, please logout and log back in and then try again.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe mention Anonymous users are not allowed to create devboxes. instead of 403 here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to this, or maybe something more generic like "If you see an error"/"If a sandbox isn't created automatically..." in case the error message changes in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants