Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): rebuild the asset registry atomically (transient unresolved refs)

yhh7d9a42ade57e
diff --git a/desktop/src/project/ProjectStore.ts b/desktop/src/project/ProjectStore.ts
index 0f649ea5b..454722c0a 100644
--- a/desktop/src/project/ProjectStore.ts
+++ b/desktop/src/project/ProjectStore.ts
@@ -370,19 +370,21 @@ class ProjectStoreImpl {
* fetches `estella://project/<path>`.
*/
private async buildAssetRegistry(): Promise<void> {
- this.uuidToPath.clear();
- this.pathToUuid.clear();
- this.prefabCache.clear();
if (!this.state) return;
+ let entries: { uuid: string; path: string }[];
try {
- const { index } = await window.estella.project.scanAssets();
- for (const e of index.entries) {
- const uuid = e.uuid.toLowerCase();
- this.uuidToPath.set(uuid, e.path);
- this.pathToUuid.set(e.path, uuid);
- }
+ ({ entries } = (await window.estella.project.scanAssets()).index);
} catch (err) {
console.warn('[project] asset scan failed', err);
+ return;
+ }
+ this.uuidToPath.clear();
+ this.pathToUuid.clear();
+ this.prefabCache.clear();
+ for (const e of entries) {
+ const uuid = e.uuid.toLowerCase();
+ this.uuidToPath.set(uuid, e.path);
+ this.pathToUuid.set(e.path, uuid);
}
const assets = EngineHost.getResource(Assets);