Heading rename deletes arbitrary data, inserts garbage around heading links

Steps to reproduce

  • large file (2MB)
  • have a heading linked in 7 places inside the file and another link in a separte file
  • rename the heading

Often the rename will freeze for seconds (maybe tens of seconds)
After the modal closes, the process stays at over 100% CPU and sluggish (mostyl unresponsive)

  • The operation takes too long - suggest a bug in the rename implementation
  • The operations takes exponentially longer if heading is linked multiple times - suggests a bug in the rename implementation (possibly the same as the first one. check recursion?)
  • The operation is not transactional. Changes still hapen after modal closes. While the modal seems to take a while to dissappear, once it’s closed, changes will still take place after, further corrupting the file. As renames change non-local context, they should never be completely async. I.e. I should never get back to editor if tasks are still running
    Possibly adding rows during this time contributes to the corruption

Did you follow the troubleshooting guide? [Y]

Expected result

I expect rename to not delete my data, nor insert garbage

Actual result

Rename

Environment

SYSTEM INFO:
Obsidian version: v1.6.4
Installer version: v1.4.13
Operating system: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 23.5.0
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Base theme: light
Community theme: Minimal v7.3.2
Snippets enabled: 2
Restricted mode: on

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.


Additional information

I tried to reproduce it synthetically by creating a file with several headings and wasn’t able to.

I’m able to reproduce when copying the large file to a new file and repeating the operation

Please, attach or dm me a link with a zipped minimum vault where this happens.

Obsidian Sandbox.zip (1.1 MB)

I was able to reproduce it in sandbox with a large file.

See

  • “Start Here.md”
  • “Start Here 1.md” is a copy of the original before rename
  • “Overview 1” is a a unique heading (others are duplicated)

NOTE - IDK if it’s required for reproduction but - I also had a split tab and a separate window, all 3 with the same file.

Before rename

Expected after rename

Corrupted entries

I can’t reproduce. It’s not even slow.

Download and reinstall Obsidian. Post a screen recording of this happening in the sandbox vault (with restricted mode on/no plugins!)