st3v3nmw / obsidian-spaced-repetition

Fight the forgetting curve by reviewing flashcards & entire notes on Obsidian.md
https://www.stephenmwangi.com/obsidian-spaced-repetition/
MIT License
1.51k stars 184 forks source link

[Bug]: SR Plugin/Parser causes whole Obsidian Application to freeze (mobile & desktop) #1111

Open cstelmach opened 3 days ago

cstelmach commented 3 days ago

Describe the bug

Upon opening the application, the SR Plugin causes the whole Obsidian App to freeze as soon as the plugin loads, as in no action is possible.

This is quite concerning on mobile. If I didn't have a 1s delay due to plugin groups I would have had to completely reset my vault because of this spaced repetition plugin bug.

This is may be somehow connected to the flashcards parser functionality changed in 1.12.6, since this is the last step shown if I turn on the debugger functionality on desktop obsidian (see screenshots). Also if I remove all tags (as in no flashcards notes), then the app starts normally.

I've found this error only happens in the plugin versions 1.12.6+. (tested .5, .6, .7, .8, .9) I'm now using the 1.12.5 version, as it at least allows opening the application. It still comes with bugs and errors, but ...


After trying out a few things, there is a markdown in the context which by itself causes 77s freezing.

To Reproduce

  1. Open the app with the markdown file as flashcard
  2. wait 1 second
  3. try to click navigation or anything else. Application frozen.
  4. Wait for a few minutes for it to unfreeze, hoping it completes (if you have a single markdown file, else forget it).

Expected behavior

The app is functional.

Screenshots

v1.12.5 (doesn't freeze)

image

v1.12.9 (freezes, as any above 1.12.6 does too)

Screenshot 2024-10-06 at 23 08 19

OS of your device

MacOS 14.4.1 (23E224)

Obsidian version

v1.6.7

Plugin version

v1.12.6/7/8/9

Installer version

'5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) obsidian/1.4.14 Chrome/114.0.5735.289 Electron/25.8.1 Safari/537.36'

Additional context

The console output of a single markdown file, which nevertheless causes the application to load for 77s on desktop obsidian:

plugin:obsidian-spaced-repetition:12980 Text to parse:
<<<

## Important Concepts

### Text Functions

- **`lower(string)`**: Converts the given string to lowercase.

  Example:
  ```sql
  SELECT lower('The') FROM textfun;
  -- Result: 'the'

plugin:obsidian-spaced-repetition:12702 The parsers grammar is provided below. You can test it with https://peggyjs.org/online.html. plugin:obsidian-spaced-repetition:12705 {info: 'Copy the grammar by right-clicking on the property…hen, paste it in https://peggyjs.org/online.html.', grammar: '{\n // The fallback case is important if we want…000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])\n'} plugin:obsidian-spaced-repetition:12717 New parser generated in 28 milliseconds. plugin:obsidian-spaced-repetition:12996 Parsed cards: [] plugin:obsidian-spaced-repetition:28196 SR: Decks _Deck {deckName: 'root', newFlashcards: Array(0), dueFlashcards: Array(0), subdecks: Array(0), parent: null} plugin:obsidian-spaced-repetition:28197 SR: Sync took 77842ms

The markdown file: uC13-35 Text Function In SQL 20240823-1747.md

Config file

data.json

st3v3nmw commented 1 day ago

Thanks for the bug report @cstelmach. There was a parser change which has made the plugin much slower... I'm working on a fix.