Skip to content

Change useSandbox hook api#525

Open
Magmusacy wants to merge 6 commits intomainfrom
sandbox-rework/FCE-3255
Open

Change useSandbox hook api#525
Magmusacy wants to merge 6 commits intomainfrom
sandbox-rework/FCE-3255

Conversation

@Magmusacy
Copy link
Copy Markdown
Collaborator

Description

Changed the api of useSandbox hook as well as updated e2e livestream tests to support this new api

Motivation and Context

we've changed how users communicate with room manager

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)

@linear
Copy link
Copy Markdown

linear Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the useSandbox hook API to require an explicit Room Manager URL, and adjusts the livestream e2e client to use the new API as part of the changed Room Manager communication approach.

Changes:

  • Change useSandbox from an optional-props hook (deriving URL from FishjamProvider) to a required { sandboxApiUrl } API.
  • Update the livestream e2e app to pass ROOM_MANAGER_URL into useSandbox.
  • Introduce ROOM_MANAGER_URL config sourced from VITE_ROOM_MANAGER_URL.

Reviewed changes

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

File Description
packages/react-client/src/hooks/useSandbox.ts Makes sandboxApiUrl mandatory and removes URL derivation from FishjamProvider/fishjamId.
e2e-tests/livestream-client/src/App.tsx Updates e2e app to call useSandbox({ sandboxApiUrl: ROOM_MANAGER_URL }).
e2e-tests/livestream-client/config.ts Adds ROOM_MANAGER_URL env-based config for the new required hook parameter.

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

Comment thread packages/react-client/src/hooks/useSandbox.ts Outdated
Comment on lines 17 to 20
export const useSandbox = ({ sandboxApiUrl }: UseSandboxProps) => {
const getSandboxPeerToken = useCallback(
async (roomName: string, peerName: string, roomType: RoomType = "conference") => {
const url = new URL(sandboxApiUrl);
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Now that sandboxApiUrl is fully caller-provided, the later string concatenations like ${sandboxApiUrl}/${roomName}/... and ${sandboxApiUrl}/livestream become sensitive to trailing slashes (double //) and unescaped roomName path segments. It’d be safer to normalize sandboxApiUrl (trim a trailing /) and build paths via new URL() + encodeURIComponent(roomName) to avoid malformed requests.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

not our problem i think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

eventually each customer problem is our problem - worth checking if it breaks once the trailing slash is added

Comment thread packages/react-client/src/hooks/useSandbox.ts
Comment thread e2e-tests/livestream-client/config.ts Outdated
Comment thread e2e-tests/livestream-client/src/App.tsx Outdated
Comment thread packages/react-client/src/hooks/useSandbox.ts Outdated
Comment thread packages/react-client/src/hooks/useSandbox.ts Outdated
@Magmusacy Magmusacy requested a review from czerwiukk May 4, 2026 09:04
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.

3 participants