diff --git a/src/ui/ArenaSession.ts b/src/ui/ArenaSession.ts index 4937816..1728fca 100644 --- a/src/ui/ArenaSession.ts +++ b/src/ui/ArenaSession.ts @@ -117,12 +117,28 @@ export default class ArenaSession { this.plugin.registerDomEvent(win, 'beforeunload', this.popoutUnloadHandler); } + await this.preloadFileIds(); this.pickNextPair(); await this.openCurrent(); this.updateOverlay(); this.updateStabilityBar(); } + /** + * Read note IDs for all files up-front so the matchmaker can look up + * actual stats on the first pair pick, allowing the information-gain + * algorithm to prioritise genuinely new notes. + */ + private async preloadFileIds(): Promise { + const propName = this.plugin.settings.idPropertyName; + await Promise.all( + this.files.map(async (f) => { + const id = await getNoteId(this.app, f, propName); + if (id) this.idByPath.set(f.path, id); + }), + ); + } + async end(opts?: { forUnload?: boolean }) { this.clearScrollSync();