Skip to content

FCE-3321 throw missing sandbox url error when calling methods#534

Merged
czerwiukk merged 1 commit into
mainfrom
FCE-3321/raise-no-sandbox-url-when-invoking-methods
May 12, 2026
Merged

FCE-3321 throw missing sandbox url error when calling methods#534
czerwiukk merged 1 commit into
mainfrom
FCE-3321/raise-no-sandbox-url-when-invoking-methods

Conversation

@czerwiukk

Copy link
Copy Markdown
Member

Description

Moves the no sandbox url error to the moment user calls the backend.

Documentation impact

  • Documentation update required
  • Documentation updated in another PR
  • No documentation update required

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)

@czerwiukk czerwiukk requested a review from Copilot May 12, 2026 15:20
@czerwiukk czerwiukk self-assigned this May 12, 2026
@linear

linear Bot commented May 12, 2026

Copy link
Copy Markdown

FCE-3321

@czerwiukk czerwiukk merged commit 30f99e0 into main May 12, 2026
4 checks passed
@czerwiukk czerwiukk deleted the FCE-3321/raise-no-sandbox-url-when-invoking-methods branch May 12, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts useSandbox error timing so a missing sandboxApiUrl error is thrown when sandbox backend methods are invoked (rather than when the hook is created), improving ergonomics for consumers that conditionally call sandbox APIs.

Changes:

  • Introduces a dedicated MissingSandboxApiUrlError error type.
  • Moves the “missing sandboxApiUrl” failure from useSandbox initialization into each backend-calling method in the hook.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/react-client/src/utils/errors.ts Adds MissingSandboxApiUrlError for a more specific missing-config failure.
packages/react-client/src/hooks/useSandbox.ts Defers missing sandboxApiUrl failures to the point where sandbox methods are called.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 19 to 21
export const useSandbox = (props: UseSandboxProps) => {
const sandboxApiUrl = props?.sandboxApiUrl;

if (!sandboxApiUrl) {
throw new Error("useSandbox requires a sandboxApiUrl, you can get it at: https://fishjam.io/app/sandbox");
}
const sandboxApiUrl = props.sandboxApiUrl;

Comment on lines 22 to +25
const getSandboxPeerToken = useCallback(
async (roomName: string, peerName: string, roomType: RoomType = "conference") => {
if (!sandboxApiUrl) throw new MissingSandboxApiUrlError();

Comment thread packages/react-client/src/utils/errors.ts
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.

2 participants