Skip to content

Commit db767df

Browse files
authored
fix: initialize root fs once (#160)
1 parent b59978b commit db767df

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/sumi-core/src/server/core/filesystem.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ export const filesystemDeferred = new Deferred<void>();
1111
export const isFilesystemReady = () => filesystemDeferred.promise;
1212

1313
let mountfs: RootFS | null = null;
14+
let mountfsDeferred: Deferred<RootFS> | null = null;
1415

1516
export const initializeRootFileSystem = async () => {
16-
if (mountfs) return mountfs;
17+
if (mountfsDeferred) return mountfsDeferred.promise;
1718

19+
mountfsDeferred = new Deferred<RootFS>();
1820
mountfs = (await createFileSystem(FileSystem.MountableFileSystem, {})) as RootFS;
21+
mountfsDeferred.resolve(mountfs);
22+
1923
initialize(mountfs);
2024
filesystemDeferred.resolve();
2125
return mountfs;

0 commit comments

Comments
 (0)