Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix: avoid racing memo creation sync

tianma-ifacb5993f8629
diff --git a/apps/web/src/lib/repository.ts b/apps/web/src/lib/repository.ts
index 2a3cdbaa..ac752fc1 100644
--- a/apps/web/src/lib/repository.ts
+++ b/apps/web/src/lib/repository.ts
@@ -354,7 +354,11 @@ export const createWebRepository = (scope: string): EdgeEverRepository => {
createdAt: memo.createdAt,
updatedAt: memo.updatedAt,
});
- window.dispatchEvent(new CustomEvent("edgeever:sync-queue-changed"));
+ // Let the mutation success handler commit the new memo's selection before
+ // the queue worker starts remapping its temporary ID. Otherwise the sync
+ // callback can win the race and the list effect falls back to the first
+ // memo (the demo welcome note).
+ window.setTimeout(() => window.dispatchEvent(new CustomEvent("edgeever:sync-queue-changed")), 0);
return { memo };
},