Skip to content

Commit 892e172

Browse files
[Fix] Flipper Warning (#285)
1 parent a65cd8c commit 892e172

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

.changeset/pretty-waves-flow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/react-native': patch
3+
---
4+
5+
fixed Flipper warning still showing if an HTTP request rejected due to an error.

packages/react-native/src/sync/stream/ReactNativeRemote.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,24 @@ export class ReactNativeRemote extends AbstractRemote {
6363
}, STREAMING_POST_TIMEOUT_MS)
6464
: null;
6565

66-
const result = await super.postStream({
67-
...options,
68-
fetchOptions: {
69-
...options.fetchOptions,
70-
/**
71-
* The `react-native-fetch-api` polyfill provides streaming support via
72-
* this non-standard flag
73-
* https://github.com/react-native-community/fetch#enable-text-streaming
74-
*/
75-
// @ts-expect-error https://github.com/react-native-community/fetch#enable-text-streaming
76-
reactNative: { textStreaming: true }
66+
try {
67+
return await super.postStream({
68+
...options,
69+
fetchOptions: {
70+
...options.fetchOptions,
71+
/**
72+
* The `react-native-fetch-api` polyfill provides streaming support via
73+
* this non-standard flag
74+
* https://github.com/react-native-community/fetch#enable-text-streaming
75+
*/
76+
// @ts-expect-error https://github.com/react-native-community/fetch#enable-text-streaming
77+
reactNative: { textStreaming: true }
78+
}
79+
});
80+
} finally {
81+
if (timeout) {
82+
clearTimeout(timeout);
7783
}
78-
});
79-
80-
if (timeout) {
81-
clearTimeout(timeout);
8284
}
83-
return result;
8485
}
8586
}

0 commit comments

Comments
 (0)