Skip to content

Commit 4863936

Browse files
committed
Fix occasional random crashes when uploading large images
- see firebase/firebase-js-sdk#5848 (comment)
1 parent 95ac2ef commit 4863936

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/node_modules/@firebase/storage/dist/index.esm2017.js b/node_modules/@firebase/storage/dist/index.esm2017.js
2+
index 55274f8..04497ab 100644
3+
--- a/node_modules/@firebase/storage/dist/index.esm2017.js
4+
+++ b/node_modules/@firebase/storage/dist/index.esm2017.js
5+
@@ -405,7 +405,6 @@ backoffCompleteCb, timeout) {
6+
return;
7+
}
8+
if (success) {
9+
- clearGlobalTimeout();
10+
triggerCallback.call(null, success, ...args);
11+
return;
12+
}

screens/Todos.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,9 @@ const Todo = () => {
138138
};
139139

140140
const getBlobFromUri = async (uri) => {
141-
return new Promise((resolve, reject) => {
142-
const xhr = new XMLHttpRequest();
143-
xhr.onload = function () {
144-
resolve(xhr.response);
145-
};
146-
xhr.onerror = function () {
147-
reject(new TypeError("Network request failed"));
148-
};
149-
xhr.responseType = "blob";
150-
xhr.open("GET", uri, true);
151-
xhr.send(null);
152-
});
141+
const response = await fetch(uri);
142+
const blob = await response.blob();
143+
return blob;
153144
};
154145

155146
const setTaskProof = async (item, url) => {

0 commit comments

Comments
 (0)