@vue-skuilder/db 0.1.34 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.1.34",
7
+ "version": "0.1.35",
8
8
  "description": "Database layer for vue-skuilder",
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/index.mjs",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@nilock2/pouchdb-authentication": "^1.0.2",
51
- "@vue-skuilder/common": "0.1.34",
51
+ "@vue-skuilder/common": "0.1.35",
52
52
  "cross-fetch": "^4.1.0",
53
53
  "moment": "^2.29.4",
54
54
  "pouchdb": "^9.0.0",
@@ -62,5 +62,5 @@
62
62
  "vite": "^8.0.0",
63
63
  "vitest": "^4.1.0"
64
64
  },
65
- "stableVersion": "0.1.34"
65
+ "stableVersion": "0.1.35"
66
66
  }
@@ -373,6 +373,17 @@ export class SessionController<TView = unknown> extends Loggable {
373
373
  // Exclude all cards already presented this session. The pipeline may
374
374
  // not yet see their encounter records (async writes), so without this
375
375
  // they can re-enter newQ via replaceAll and cause duplicates.
376
+ //
377
+ // Also exclude newQ.peek(0): the imminent draw. When a replan fires
378
+ // from inside nextCard() (auto depletion/quality trigger) or as a
379
+ // deferred post-submit replan, the next-up card is about to become
380
+ // _currentCard but isn't yet, and hasn't yet landed in _sessionRecord.
381
+ // Without this, the just-drawn card can be re-seated at the head of
382
+ // the replaced newQ and shown twice in a row — most visible in early
383
+ // sessions where state is sparse and triggers fire aggressively.
384
+ // Only the head is excluded; deeper newQ entries are still fair game
385
+ // for the new plan (they aren't at risk of double-display since the
386
+ // old queue is replaced atomically and only its head gets drawn).
376
387
  if (!opts.hints) opts.hints = {};
377
388
  const hints = opts.hints;
378
389
  const excludeSet = new Set(hints.excludeCards ?? []);
@@ -383,6 +394,9 @@ export class SessionController<TView = unknown> extends Loggable {
383
394
  for (const rec of this._sessionRecord) {
384
395
  excludeSet.add(rec.card.card_id);
385
396
  }
397
+ if (this.newQ.length > 0) {
398
+ excludeSet.add(this.newQ.peek(0).cardID);
399
+ }
386
400
 
387
401
  hints.excludeCards = [...excludeSet];
388
402