Skip to content

Change useSandbox hook api#525

Merged
Magmusacy merged 10 commits into
mainfrom
sandbox-rework/FCE-3255
May 12, 2026
Merged

Change useSandbox hook api#525
Magmusacy merged 10 commits into
mainfrom
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

linear Bot commented Apr 29, 2026

Copy link
Copy Markdown

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 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);

Copilot AI Apr 29, 2026

Copy link

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

@czerwiukk czerwiukk left a comment

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.

update e2e test utils to use sandbox url instead of building on fishjam_url, line 86 scenarios/utils.ts

@Magmusacy Magmusacy requested a review from czerwiukk May 12, 2026 13:19
@Magmusacy Magmusacy merged commit 6d28d19 into main May 12, 2026
2 checks passed
@Magmusacy Magmusacy deleted the sandbox-rework/FCE-3255 branch May 12, 2026 13:49
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