Closed kimadeline closed 2 years ago
Yeah it seems some layer caches the error promises. Two possibilities:
Failed to fetch
is not coming from any of my layers and is a good indication that the editor indeed attempts to "fetch".
We actually resolve the file from its location every time you switch tabs to poll for new changes.
The problem is not the Failed to fetch
per se, but rather that some code caches that error when it happens due to being offline and keeps returning it even after going online, when the promise would actually succeed.
The console shows this error:
ERR HttpError: Failed to fetch
at eval (extension.js:117:7584)
at Su.request (extension.js:119:25450)
at Su.getBlobContent (extension.js:219:727)
at Su.getFileContent (extension.js:219:1422)
at vc.readFile (extension.js:112:14864)
at Ys.readFile (extension.js:107:27024)
The extension is: https://github.vscode-unpkg.net/GitHub/remotehub/0.23.2022012602/extension/dist/browser/extension.js#vscode-extension:formatted
@joaomoreno is spot on, RemoteHub constructs a filetree representing the repo contents where each file has a memoized getContent
method that returns a promise resolving to the file contents. That's where the stacktrace above is coming from. We need to know when to clear out the memoized promise. ~We could use some heuristics like refetching the filetree when we see a 'failed to fetch' like the above.~ We shouldn't be caching promises which resolve to errors.
Still reproduces for me Offline: Back online:
Sorry, forgot to publish a new pre-release with the fixes. Just published one and verified it works for me in the PWA--please give it a try again and thank you for testing!
Testing #141296
Repro steps: