Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mudloop committed Nov 9, 2024
1 parent 45effc7 commit 7d7a8de
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions builders/generated/source-transformer.worker.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/bundle/js/index.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/bundle/js/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/bundle/js/previews.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/service.worker.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion playground/src/state/BuildManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ export class BuildManager {
}
private update = async () => {
const files = await this.fs.findAll<MagicFile>(entry => entry.isFile);
Object.keys(this.builds).forEach(path => {
if (!files.find(file => file.path == path)) {
delete this.builds[path];
}
})
files.map(file => {
if (!file.isFile) return;
// if (!file.isFile) return;
const builder = this.builders.find(builder => builder.test(file.path));
if (!builder) return;

Expand Down
1 change: 1 addition & 0 deletions playground/src/state/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Project {
if (detail.type == 'unlink') this.closeFile(detail.id);
}
this.onFilesChange.trigger();
this.onChange.trigger();
});
this.buildManager = new BuildManager(this, App.builders);
}
Expand Down
1 change: 1 addition & 0 deletions utilities/src/MagicFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class MagicFS {
get = async <T extends MagicFSEntry>(path: string) => this.root.get<T>(sanitizePath(path));
rename = async (entry: MagicFSEntry, path: string) => {
await this._volume.rename(entry.path, path);
entry.path = path;
entry.reset();
(await entry.parent)!.reset();
};
Expand Down
9 changes: 6 additions & 3 deletions utilities/src/VirtualFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,12 @@ export class Volume {
public readTxn = <T>(handler: (reader: VolumeReader) => Promise<T>, stores?: string[]) => this.db.read(stores ?? allStores, accessors => handler(new VolumeReader(this.id, accessors)))
public writeTxn = async<T>(handler: (writer: VolumeWriter) => (Promise<T> | T), stores?: string[]) => {
const operations: Operation[] = [];
const result = await this.db.write(stores ?? allStores, accessors => new VolumeWriter(this.id, accessors, operations).execute(handler));
this.broadcast(operations);
return result;
const promise = this.db.write(stores ?? allStores, accessors => new VolumeWriter(this.id, accessors, operations).execute(handler));
promise.then(async () => {
await new Promise(resolve => requestAnimationFrame(resolve));
return this.broadcast(operations);
});
return promise;
}

public getMeta = () => this.readTxn(reader => reader.getMeta());
Expand Down

0 comments on commit 7d7a8de

Please sign in to comment.