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”.