[bug] Hang on creating metadata field above a table

Steps to reproduce

I have a note with a table in it and some text underneath that. The note has no headings, text and no metadata at the top. It starts with the table. When I started typing --- to start the YAML block above the tale Obsidian hung. I quit a reloaded and reproduced this several times. The only way out of it was to edit the note in another editor (BBEdit) and add the metadata. After that it was fine.

Expected result

Should just be able to add lines of anything above the table.

Actual result

Hang.

Environment

  • Operating system: Mac OS 12.1

  • Debug info:
    This was the dev console error:

app.js:1 RangeError: Invalid change range 591 to 2 (in doc of length 11530) at e (app.js:1) at e (app.js:1) at Function.t.of (app.js:1) at t.transaction (app.js:1) at t.e.newlineAndIndentOnly (app.js:1) at shift (app.js:1) at c (app.js:1) at gc (app.js:1) at Object.keydown (app.js:1) at e.runCustomHandlers (app.js:1) at HTMLDivElement.<anonymous> (app.js:1) at HTMLDivElement.e (eval at <anonymous> (app.js:1), <anonymous>:333:36332)


Additional information

Happy to supply the note file directly to the developers. I can’t post it publicly here.

Does it happen in the help vault?

you get the debug info using the show debug in command palette. You can attach the note with a DM to me.

Sorry, somehow missed this. It does happen with the Help vault. I tried a different table and it still happens. I can’t get the debug info because it hangs bad enough to just freeze Obsidian so badly, in fact, that I can no longer open the Help vault. I just get a blank window.

This is, by the way, in Source mode in the Editor.

can you please attach a copy of the file that is causing this?

Any table will do it, but I’ve attached one for you.
d20 Looting a Body.md (9.5 KB)
Here is how to reproduce it (Mac OS 12.1, Obsidian build 0.14.2, source edit mode, not live preview):

  1. Create a note
  2. Paste in a markdown table (or combine 1. & 2. and open a note with a table in it). Ensure there are no headings above the table. The crash happens when the table is the first thing in the file.
  3. Start to type --- and return to create YAML metadata.
  4. Watch it hang.

Sometimes you can get to the next line before the hang, but it will hang. Also, it boinked my Help vault in the app, so assume this is vault destructive.

I do get a two second freeze but no hang.
what is the output of show debug info, even before the bug happens.

It freezes as soon as you type --- and then again as you try and write any metadata and then again when you try to close the metadata with ---. On a small note or vault, it’s a freeze of several seconds. On larger vaults it seems to really hang.

The dev panel in Obsidian/Chrome is a UI nightmare. Can you give me a few more specifics about what you’re after? I ran the performance recording and saved the attached profile.

In the Issues pane I get this:

Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
A page or script is accessing at least one of navigator.userAgent, navigator.appVersion, and navigator.platform. Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.
To fix this issue, replace the usage of navigator.userAgent, navigator.appVersion, and navigator.platform with feature detection, progressive enhancement, or migrate to navigator.userAgentData.
Note that for performance reasons, only the first access to one of the properties is shown.
1 source
codemirror.js:1

Profile-20220406T114844.json.zip (1.1 MB)