Skip to content

Commit e652fc5

Browse files
CAMOBAPclaude
andcommitted
fix: correct onMessage payload extraction and increase bridgeTimeout for CI
- SandboxReactNativeView wrapper already unwraps e.nativeEvent.data before calling onMessage, so msg IS the data directly (not msg.data). iOS sends an object, Android sends a JSON string — handle both with typeof check. - Switch beforeAll to waitFor/queryByTestId to avoid findByTestId 3-arg API - Increase bridgeTimeout from default 60s to 120s so iOS CI simulator has enough time to install and boot the app after a long Xcode build Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 99c2dad commit e652fc5

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

apps/fs-experiment/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ function App(): React.JSX.Element {
125125
useSubstitution ? SANDBOXED_SUBSTITUTIONS : undefined
126126
}
127127
onMessage={msg => {
128-
if (msg.cmd === 'ready') setSandboxReady(true)
128+
const payload = typeof msg === 'string' ? JSON.parse(msg) : msg
129+
if (payload?.cmd === 'ready') setSandboxReady(true)
129130
console.log('Host received from sandbox:', msg)
130131
}}
131132
onError={err =>

apps/fs-experiment/__tests__/sandbox-isolation.harness.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
expect,
99
it,
1010
render,
11+
waitFor,
1112
} from 'react-native-harness'
1213

1314
import App from '../App'
@@ -86,9 +87,14 @@ describe('Substitution OFF', () => {
8687
beforeAll(async () => {
8788
blockCleanup = true
8889
await render(<App />, {timeout: RENDER_TIMEOUT})
89-
await screen.findByTestId('sandbox-ready', {
90-
timeout: SANDBOX_READY_TIMEOUT,
91-
})
90+
await waitFor(
91+
() => {
92+
if (!screen.queryByTestId('sandbox-ready')) {
93+
throw new Error('Sandbox not ready')
94+
}
95+
},
96+
{timeout: SANDBOX_READY_TIMEOUT}
97+
)
9298
}, SANDBOX_READY_TIMEOUT + RENDER_TIMEOUT)
9399

94100
if (isIOS) {

apps/fs-experiment/rn-harness.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const config = {
3333
forwardClientLogs: true,
3434
resetEnvironmentBetweenTestFiles: true,
3535
disableViewFlattening: true,
36+
bridgeTimeout: 120_000,
3637
}
3738

3839
export default config

0 commit comments

Comments
 (0)