javalent / fantasy-statblocks

Create Dungeons and Dragons style statblocks for Obsidian.md
MIT License
339 stars 68 forks source link

🐞 styles.css formatting makes some pages render very slowly #413

Open Pachtjuilaard opened 2 months ago

Pachtjuilaard commented 2 months ago

Check for existing bug reports before submitting.

Expected Behavior

My character sheet, containing a statblock, should load normally. A page with a dataview table containing 100 notes from my bestiary, with all pages containing a statblock, should load within the 8+ seconds it does now.

Current behaviour

Since a few updates of the plugin, my character sheet (containing a statblock for familiars) would run incredibly slowly, hang, and crash Obsidian. A dataview table with 100 monsters would also hang Obsidian for a bit.

Through checking console, running performance tests, checking all kinds of plugins, new vault, everything, I've found that the problem was resolved after deleting styles.css and reloading the vault.

When I download styles.css, it seems to be formatted without any newlines for the most part. When opening text files with loooong lines (making me scroll miles to the right in the text editor), it also takes a long time to open that file. Replacing all ";" with "; " seems to have resolved the issue. Could you change the formatting of the css file to have newlines, instead of the first line of the file having 1407037 characters?

Disabling the Markdown Attributes plugin helps a tiny bit, but does not completely resolve the issue.

Reproduction

  1. Have the statblocks plugin installed.
  2. Check if styles.css has 1,000,000+ characters in the first line. If so,
  3. Make a new note and paste the dataview code below (or adapt it to fit your bestiary folder).
  4. See that the page takes a lot longer than usual to load, and see that Obsidian is unresponsive in the meantime.
table MonsterStats.challenge
from #monster/type/beast
sort MonsterStats.challenge desc
limit 100

Which Operating Systems are you using?

Obsidian Version Check

1.15.12

Plugin Version

4.3.5

Confirmation

Possible solution

Formatting styles.css to have newlines after every ";" seems to resolve the issue.