Bug when changing theme in 1.5.8?

So I’m on 1.5.8 with 1.5.3 installer, and with a few themes and plenty of plugins, I can’t change theme. It causes an error in the block below and reverts to the default template.

Javascript code causing the bug, app.js:1:1952907

t.prototype.loadTheme = function(e) {
    var t = this;
    return this.queue.queue((function() {
        return v(t, void 0, void 0, (function() {
            var t, n, i, r;
            return y(this, (function(o) {
                switch (o.label) {
                case 0:
                    return n = (t = this).styleEl,
                    i = t.theme,
                    r = "",
                    e ? (r = e,
                    [3, 3]) : [3, 1];
                case 1:
                    return i ? [4, this.loadCss(this.getThemePath(i))] : [3, 3];
                case 2:
                    r = o.sent(),
                    o.label = 3;
                case 3:
                    return n.textContent !== r && (n.textContent = r,
                    this.app.workspace.trigger("css-change"),
                    this.app.workspace.trigger("resize")),
                    [2]
                }
            }
            ))
        }
        ))
    }
    ))
}

And the fault is on the return statement of “Case 3”, where the full error message is the following:

app.js:1 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'textContent')
    at t.<anonymous> (app.js:1:1952907)
    at app.js:1:237544
    at Object.next (app.js:1:237649)
    at a (app.js:1:236367)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
(anonymous) @ app.js:1
a @ app.js:1

I’m not sure why it’s assuming that there is a textContent in “Case 3”, and what it refers to. So even though the fix is rather easy and should probably include that there is a n.textContent before checking its content. Upon closer inspection this code should never work, since n is not declared at all, as far as I can tell…


However, I couldn’t trigger “Case 3” in the Sandbox vault, so therefore I’m asking for your guidance whether you’ve experienced this and know the workaround/fix, or what to do next. It sure seems like a true bug, but I can’t file a proper bug since I can’t reproduce it properly, although this code segment for loading themes looks very sketchy for “Case 3”.

I’ve now even tried to downgrade to 1.5.3, and there is something mighty strange happening at my end currently. I can’t change themes, the error message above keep appearing, and the 1.5.3 package includes an 1.5.8.asar files… This is getting depressing.

In the attempt to downgrade I did the following:

  • Closed down Obsidian
  • Removed it from the Application folder
  • Removed it from ~/Library/Application support/obsidian (Yes, I removed the entire folder :slight_smile: )
  • Emptied out the trash
  • Went to Releases · obsidianmd/obsidian-releases · GitHub, and downloaded (again) the Obsidian-1.5.3-universal.dmg package, and reinstalled

Now it reports that it’s 1.5.3 with the 1.5.3 installer, but it still shows the 1.5.8 asar file, and it has the same error messages when trying to switch theme in both of my vaults.


Update: Could there be anything vault specific which can cause this kind of anomalies? It seems like I can change themes in the Sandbox vault… Or is it some configuration left over from when I ran these vaults in the 1.5.8 version?

Linux user here (always use the Debian package, never snap, flatpak or appimage).

Did the same thing as said above (unchecked automatic updates the second time with WiFi off). I usually like to delete all from config folder to start afresh – necessary after a while when search (17.8k vault with images) becomes slow.

No asar file detected in folder upon reinstalling 1.5.3 here. (I didn’t check inside(?) Debian package, which was downloaded from releases.)

Didn’t change themes (I’ll die using this skimpy theme I have) and didn’t try Windows (no, thanks). Didn’t really test the 1.5.8 version before I went back to 1.5.3. On the iPad, I went back to 1.4.16 (18?) almost instantly.

The rest I talked (to myself) about here:

So after more research, and a file system scan for various rand cases, I discovered that I had a faulty symlink in my vault/.obsidian/snippets folder. When I removed that, and did a Force reload stuff start working again.

Unknown why its happening, another fault I recently experienced related to the Custom File Explorer sorting plugin also resolved itself it, when the faulty symlink was removed.

I filed a bug report on the faulty symlink issue, so I reckon this is now solved with the fix/workaround to remove faulty symlinks.

I hear you… Although, or possibly just because, I’ve been fairly active in this community, as you’ve also been, it’s not a good feeling when you post something and there is almost dead silence…

1 Like

No issue on that behalf. It was all about the faulty symlink, somehow…

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.