mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-27 16:37:18 +00:00
Prevent Files tab lockup when readdir fails
renderDirectory sets renderingDirectory=true then awaits puter.fs.readdir with no error handling. readdir rejects on any backend error (permission, deleted directory, network), leaving renderingDirectory stuck true so the re-entry guard blocks all future navigation and the spinner never clears. Catch the rejection and reset state.
This commit is contained in:
@@ -1811,7 +1811,18 @@ const TabFiles = {
|
||||
const readdirArg = isPath
|
||||
? { path: target, consistency: options.consistency || 'eventual' }
|
||||
: { uid: target, consistency: options.consistency || 'eventual' };
|
||||
let directoryContents = await window.puter.fs.readdir(readdirArg);
|
||||
let directoryContents;
|
||||
try {
|
||||
directoryContents = await window.puter.fs.readdir(readdirArg);
|
||||
} catch ( err ) {
|
||||
// readdir rejects on any backend error (permission, deleted dir,
|
||||
// network). Without this, renderingDirectory would stay true and
|
||||
// the guard above would block all further navigation.
|
||||
console.error('Failed to read directory:', err);
|
||||
this.hideSpinner();
|
||||
this.renderingDirectory = false;
|
||||
return;
|
||||
}
|
||||
if ( ! directoryContents ) {
|
||||
this.hideSpinner();
|
||||
this.renderingDirectory = false;
|
||||
|
||||
Reference in New Issue
Block a user