Skip to content

fix(mobile): patch streaming-fetch to tolerate readyState 1->4 jump on Android - #228

Open
aymanmali wants to merge 1 commit into
CopilotKit:mainfrom
aymanmali:fix/android-streaming-fetch-200
Open

aymanmali wants to merge 1 commit into
CopilotKit:mainfrom
aymanmali:fix/android-streaming-fetch-200

Conversation

@aymanmali

Copy link
Copy Markdown

Fixes #215

Summary

On Android, @copilotkit/react-native's streaming-fetch polyfill throws StreamingFetchError: Connection terminated unexpectedly on buffered 200 responses when XMLHttpRequest transitions directly from readyState === 1 to readyState === 4 without an intermediate HEADERS_RECEIVED/LOADING callback.

Changes

  • Added a pnpm patch for @copilotkit/react-native@1.70.1 (patches/@copilotkit__react-native@1.70.1.patch, registered in pnpm-workspace.yaml and pnpm-lock.yaml) updating src/streaming-fetch.ts and its built dist/ bundles so a readyState === 4 transition with status === 200 (or any non-zero HTTP status) resolves headersPromise and completes normally.
  • Added regression test apps/mobile/test/streaming-fetch-patch.test.ts verifying a buffered 200 response where readyState jumps from 1 to 4 succeeds instead of throwing.

Verification

  • pnpm format
  • pnpm lint
  • pnpm typecheck
  • pnpm test (524/524 passed)

This branch has not been deployed

No deployments
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.

[Bug] Android: Apps page can reject a valid workspace 200 ("no response was produced")

1 participant