Steps to reproduce
- Perform a search in Obsidian
- Note the results are expanded and Sort order has reset back to File name (A to Z)
Expected result
Search results stay expanded/collapsed and sorted according to most recent preference. E.g. in my case I almost always prefer my results be sorted in Date modified (new→old) order.
Actual result
Frequently, I find that my preferences have reverted back to expanding search results, and sorting alphabetically.
Environment
SYSTEM INFO:
Obsidian version: v1.7.7
Installer version: v1.7.7
Operating system: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 24.1.0
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: on
Live preview: off
Base theme: dark
Community theme: none
Snippets enabled: 15
Restricted mode: off
Plugins installed: 65
Plugins enabled: 38
1: Colored Tags Wrangler v0.19.3
2: Command Block List v0.1.4
3: Image Context Menus v1.9.1
4: Dataview v0.5.67
5: Execute Code v2.0.0
6: File Cleaner Redux v1.2.0
7: Find orphaned files and broken links v1.10.1
8: Hide Folders v1.5.1
9: Hot Reload v0.1.13
10: Hotkey Helper v0.3.20
11: Image Captions v1.1.4
12: Janitor v1.0.7
13: Mousewheel Image zoom v1.0.22
14: Advanced URI v1.44.2
15: Another Quick Switcher v12.1.0
16: Convert Images to JPEG v1.0.0
17: Copy Search URL v1.2.1
18: Custom Attachment Location v4.28.1
19: Debug Log v1.2.0
20: Code Editor Shortcuts v1.14.0
21: Footnote Shortcut v0.1.3
22: Image Toolkit v1.4.2
23: Importer v1.6.12
24: Sort & Permute lines v0.7.0
25: Split Pane View Helper v1.0.3
26: Tasks v7.13.0
27: Version History Diff v2.2.1
28: Go To Heading v0.2.2
29: Omnisearch v1.25.1
30: Recent Files v1.7.1
31: Settings Search v1.3.10
32: Simple Replace v1.0.1
33: Advanced Tables v0.22.1
34: Templater v2.9.1
35: Text Extractor v0.5.2
36: Tldraw v1.14.1
37: Share as Gist v1.7.0
38: FuzzyTag v1.1.0
Additional information
I understand this bugreport is not strictly in accordance with policy due to not running in Sandbox. However, because the bug occurs at seemingly random times, and relates to search results (which are meaningless in the Sandbox vault) I have no way of really reproducing this inside the sandbox. As per Liam’s suggestion in this thread I am posting here for more visibility in the hopes that other may add comments.
Attempted workaround
I created a cronjob to run the following jq
code that resets the sort order but it’s not a good solution.
JSON='/path/to/my/vault/.obsidian/workspace.json'
jq 'walk(
if type == "object" and has("type") and .type == "search" then
.state |= (
if type == "object" and has("collapseAll") then
.collapseAll = true | .sortOrder = "byModifiedTime"
else
.
end
)
else
.
end
)' "$JSON" | sponge "$JSON"
2 Likes
I’ve noticed this too, as of v1.7.7, possibly 1.7.6.
My search results revert to uncollapsed, by Filename A-Z and only results that match case are shown. I search a lot and have many files, so results that are not case sensitive, collapsed and show by most recently modified are the most useful. I’m not enjoying resetting it for roughly half my searches. At first I though it was only when I closed and reopened Obsidian, but it has happened randomly during the day as well.
I haven’t been able to reproduce in the sandbox vault.
I don’t understand how the title of this thread says “always resets” whereas the content says “it happens at random”.
Based on the Sep 23 timing of my post on the other thread I would put my money on this bug(?) being introduced in either 1.7.1 (2024-08-27) or more likely 1.7.2 (2024-09-19).
Can this be reproduced in your vault with restricted mode on?
Sorry - title updated to better reflect reality. I will try to repro in my vault.
@WhiteNoise Well, that was easy! I literally repro’d it on the first try (with Restricted Mode on). Do you need a screen recording, or what other info can I provide? (a copy of my vault is not an option unfortunately).
Yes, please post a screen recording of this happens after restricted mode on and restart obsidian.
Also see if you get errors in console (Ctrl shift i, console)
I made a screen recording, don’t want to post publicly because note data is visible but I will PM the link to you. It’s not shown in the video but I did check the console and there were no errors there.
edit: I recorded a second video that does show the console, posted to the same gist.
DM sent. Updated the title AGAIN because now after more rigorous testing in Restricted Mode, I discovered the bug is not that the results are ALWAYS collapsed or ALWAYS expanded, it’s more that the last setting is not sticky, and reverts to some previous state.
1 Like
What is not saved is:
- The preferred sort order of search results
- The boolean (specifically the
.collapseAll
property in the workspace.json) that dictates whether results default to being collapsed or expanded.
These have always been preserved for years of using Obsidian. Something definitely changed in the last few releases.
Ok, I see that sometimes is missing.
The fold state of individual items is not supposed to be saved.
Ok, I did some tests and everything works for me EXCEPT the sort order
The global collapse toggle (the one in the search settings) works for me.
Is the behavior of flipping the global collapse toggle DIFFERENT than command⌘-clicking the disclosure triangle to the left of a single item to expand/collapse all? If it is, that is news to me and would be good to document somewhere.
The global collapse setting is preserved. The collapse state of individual items is not.
I understand what you’re saying, but I thought that command-clicking the triangle was a shortcut to the same codepath as clicking the toggle (because the end result is the same). I think I understand that you’re saying that is NOT true.
So TL;DR- there is a bug, however the bug is only related to the preservation of the sort order. I’ve updated the bug title yet again.
When I test in restricted mode I get the expected behavior - my search viewing preferences are maintained. I haven’t added any new plugins in quite some time. I’ll have to start testing them individually.
This may not be the only answer, but for me, it looks like it’s the No Dupe Leaves plugin, but not by itself. I can confirm that it’s NOT in combination with Minimal Theme Setting or Natural Language dates, so far. I don’t have time to continue testing right now.
@EggToastie I was able to easily repro the issue in Restricted mode (no plugins loaded at all) so not sure what you’re trying to determine at this point?