bjsi / bjsi/incremental-everything

[INVESTIGATION] Impact of the finding that `rem.getCards()` does not return cards that are disabled (or paused)

Open
#176 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
75
Forks
11
Avg merge
1m
Merged PRs (30d)
11

Description

RemNote developers informed that `rem.getCards()` does not return cards that are disabled (or paused).

This may be the reason why empty arrays `[]` were being returned for valid flashcard rems.

The current command can be used in the console to check if the cards of the currently focused rem are being gathered by `rem.getCards()` or if any inconsistency is found:

```
(async () => {
// 1. Get the focused Rem
const rem = await __plugin.focus.getFocusedRem();
if (!rem) {
console.error("❌ No Rem focused. Please click on the bullet of the broken Flashcard.");
return;
}

console.group(`🐞 API Inconsistency Report for Rem ID: ${rem._id}`);
console.log("Rem Text:", (await rem.text)[0]);

// TEST A: Local Object Method (The one returning [])
const startA = performance.now();
const localCards = await rem.getCards();
const timeA = performance.now() - startA;

// TEST B: Global Registry Method (The one working correctly)
const startB = performance.now();
const allCards = await __plugin.card.getAll();
const globalCards = allCards.filter(c => c.remId === rem._id);
const timeB = performance.now() - startB;

// REPORT
console.log(`[A] rem.getCards(): Found ${localCards.length} cards (${timeA.toFixed(1)}ms)`);
console.dir(localCards);

console.log(`[B] plugin.card.getAll() [Filtered]: Found ${globalCards.length} cards (${timeB.toFixed(1)}ms)`);
console.dir(globalCards);

if (localCards.length === 0 && globalCards.length > 0) {
console.error("%c🚨 INCONSISTENCY CONFIRMED 🚨", "color: red; font-size: 14px; font-weight: bold;");
console.error("The Global Registry sees the card, but the specific Rem object does not return it.");
console.log("Expected: rem.getCards() should match the global registry.");
} else {
console.log("✅ No inconsistency detected on this specific Rem.");
}

console.groupEnd();
})();
```

As the plugin runs in an iframe, make sure the console context is set to your plugin's iframe (the command must be inserted when an index.html iframe console context is selected).

We need to ponder, in light of this new information, if the changes made in v. 0.2.46 (#170 ) must be reviewed, and if there is a cheaper way to find out if a rem has flashcards in its descendants (for instance, for the priority popup checks).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the console investigation command in this issue, using a focused Rem in the plugin iframe context. Compare rem.getCards() with __plugin.card.getAll() filtered by remId, then review the changes from v0.2.46 in #170. Done means documenting the impact and deciding whether those changes need review or whether a cheaper descendant-card check is appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.