Library View causes long UI freezes when collapsing the annotation sidebar

ZotLit version

Obsidian plugin 2.2.2

Host application versions

Obsidian 1.15.0 with installer 1.15.0, Zotero 10.0.9, macOS 27.2.1

Obsidian debug info

Redacted environment summary

  • Electron 43.8.4
  • Other community plugins are enabled
  • The problem also occurs with the custom theme temporarily disabled

Reproduces in a sandbox vault?

Haven’t tried yet

Steps to reproduce

  1. Open the Library View with a large result list.
  2. Open a PDF from the library and show the annotation sidebar.
  3. Make a highlight, then close the PDF and return to the Library View.
  4. Collapse and reopen the right sidebar.

Expected behavior

The sidebar should open and close without freezing the rest of Obsidian, even when the library result list is large.

Actual behavior

The whole Obsidian window freezes for about two seconds when collapsing or reopening the sidebar. This is especially noticeable after closing a PDF. It feels like the annotation sidebar is stuck, but the Library View appears to cause most of the delay.

Logs or screenshots

A CPU profile captured during a reproduced freeze showed long synchronous layout work on the main thread. The slow stacks included Obsidian’s updateLayout and element dimension reads through innerWidth and innerHeight.

A local comparison in the same vault gave these sidebar collapse times.

Condition Approximate time
Library View visible 2.1 seconds
Only the Library View container temporarily hidden with display none 0.1 seconds
Library View visible with the custom theme disabled 1.9 seconds

All temporary changes were restored after the comparison. Raw profiles and logs are omitted to keep private paths and library metadata out of this report.

The result list also keeps offscreen rows in the DOM. In PapersLayout in 2.2.2, group.rows.map renders every returned row. There is no visible row window in that component.

Could the Library View use virtual scrolling so only visible rows and a small buffer stay mounted? That seems worth testing given the large difference when the library is hidden. The measurements point to library layout as a bottleneck, though I have not ruled out interactions with other plugins.

Thanks for the detailed report and the measurements. The comparison with the Library View hidden helped a lot.

I tried to reproduce this with 1,000 rows in the Library View, the most it shows. Collapsing the right sidebar took about 10 ms, with no freeze. I tested on Obsidian 1.14.5, so the difference may come from your setup or from 1.15.0. Could you help narrow it down?

  1. Community plugins: which other plugins are enabled? A list is fine, or the “Installed plugins” part of Show debug info.
  2. CSS snippets: are any CSS snippets enabled (Settings → Appearance → CSS snippets)? If yes, does the freeze still happen with them all turned off?
  3. Theme: which theme do you use? You said turning it off still gave 1.9 s, so I don’t expect it’s the cause, but the name helps.
  4. Sandbox vault: can you reproduce it in the sandbox vault (command palette → Open sandbox vault) with only ZotLit installed and pointed at the same Zotero library? If it doesn’t happen there, please turn your other plugins back on a few at a time to find which one brings back the freeze.

Also, if you still have the CPU profile: what functions sit above updateLayout and the innerWidth/innerHeight reads in the slow stack? Function names alone are enough, no paths or library data. They tell us which code reads the sizes over and over.

I’ve noted your virtual scrolling suggestion. Fewer mounted rows would make each layout cheaper, but I’d like to find what triggers the repeated layouts first.

I tested this in a separate vault with the default theme and no CSS snippets. With only ZotLit enabled, the sidebar click took 3 to 6 ms. I reproduced the larger freeze after enabling Editing Toolbar and my custom Micropatches plugin.

The setup was Obsidian 1.15.0 with installer 1.15.0 on macOS, ZotLit 2.2.2, Editing Toolbar 4.1.12 and Micropatches 1.11.3. With the Library View visible and 1000 rows rendered, toggling the right sidebar blocked the main thread for 1.03 to 1.05 seconds. No PDF was open. The attached CPU profile captures six programmatic clicks on the standard sidebar button, without CPU throttling.

The profile shows expensive computed style reads in Obsidian’s sidebar code and time spent in a global click handler from Micropatches. So other plugins contribute to the freeze too.

I also checked the effect of the Library View DOM size, with Tabbed 2.2.2 enabled as well. Keeping the plugins and settings unchanged, temporarily reducing the list from 1000 row elements to 30 reduced the click time from about 0.95 seconds to 0.12 seconds. Restoring the full list brought the delay back. This was a DOM reduction experiment. I have not implemented or tested a complete virtual scroller.

Could you test virtualization or another way to limit the number of rendered rows? The DOM experiment suggests this could help even with the other plugins enabled.

The attached profiles-and-measurements.zip contains two CPU profiles, the timing comparisons and reproduction notes. Library titles, annotation text and personal paths are omitted.

Could you test if things improved in v2.2.3? I’m still working on a full virtualized list implementation, but 2.2.3 include mitigation to the issue, it should render faster now.

Thanks for the update. I tested 2.2.3 in my main vault, but the sidebar still feels slow. I haven’t noticed a clear improvement in normal use.

Thanks for testing 2.2.3. ZotLit 2.2.4 ships the full virtualized list you suggested: the Papers, Table and List layouts now keep only the rows near the screen mounted, about 20 instead of all 1,000. This covers the Library View, query file tabs and query files embedded in notes.

In my test with 1,000 rows, the forced style recalculation that a sidebar toggle triggers went from about 670 ms to 90–140 ms per 20 cycles.

Once 2.2.4 is available in Community plugins, could you test it in your main vault with Editing Toolbar and Micropatches enabled, and tell me if the sidebar still freezes? A rough timing like the ones you measured before is enough.

Marked as accepted answer on GitHub.

Thanks for fixing this! The sidebar feels much faster now. I really appreciate your work on it.