Skip to content

Commit 7d62ce2

Browse files
authored
Merge pull request #278 from codeitcodes/benhatsor-patch-1
Fix Live View big file fetching
2 parents b73f472 + b15eba5 commit 7d62ce2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

live-view/live-view.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,9 +1062,10 @@ async function handleLiveViewRequest(requestPath) {
10621062

10631063

10641064
// if file is over 1MB
1065-
if (resp.errors && resp.errors.length > 0 && resp.errors[0].code === 'too_large') {
1065+
if ((resp.errors && resp.errors.length > 0 && resp.errors[0].code === 'too_large') ||
1066+
(resp.size && resp.size >= 1000000 && resp.content === '')) {
10661067

1067-
console.log('[Live view] File', fileName, 'over 1MB, fetching from blob API');
1068+
// console.log('[Live view] File', fileName, 'over 1MB, fetching from blob API');
10681069

10691070
// fetch file directory
10701071
const dirResp = await git.getItems(liveFileDir);

service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
// update worker name when updating cached files
3-
const WORKER_NAME = 'codeit-worker-v770';
3+
const WORKER_NAME = 'codeit-worker-v771';
44

55

66
self.importScripts('/worker/client-channel.js');

0 commit comments

Comments
 (0)