Skip to content

Commit 3553670

Browse files
authored
fix(views): calendar view broken after theme toggle (#3765)
* fix(views): broken calendar view on theme toggle This commit just removes a default value for the `initialTheme` parameter inside the views util `getWebviewContent`. `genVSCodeHTMLIndex`, which is called with a forwarded `initialTheme`, has a codepath for an undefined `initialTheme` parameter. It means that no theme is going to override the default theme and therefore a certain ordering of css file references is taking place. So by always providing a default theme this codepath is never taken and results into a broken calendar view when toggling theme value. Removing that makes sure that the default theme is setup in way that keeps proper style ordering in place. That default theme was added as a solution for [[dendron://private/task.2022.05.31.fix-styling-for-plugin-views]] does not seam to be necessary for that. * chore(internal): fix invalid test-workspace note
1 parent 97ae0d0 commit 3553670

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

packages/plugin-core/src/views/utils.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
DUtils,
88
getStage,
99
getWebTreeViewEntry,
10-
ThemeType,
1110
} from "@dendronhq/common-all";
1211
import {
1312
findUpTo,
@@ -117,13 +116,6 @@ export class WebViewUtils {
117116
.toString();
118117
});
119118

120-
const vscodeColorTheme = vscode.window.activeColorTheme.kind;
121-
const defaultInitialTheme =
122-
vscodeColorTheme === vscode.ColorThemeKind.Dark ||
123-
vscodeColorTheme === vscode.ColorThemeKind.HighContrast
124-
? ThemeType.DARK
125-
: ThemeType.LIGHT;
126-
127119
const out = WebViewCommonUtils.genVSCodeHTMLIndex({
128120
jsSrc: panel.webview.asWebviewUri(jsSrc).toString(),
129121
cssSrc: panel.webview.asWebviewUri(cssSrc).toString(),
@@ -144,7 +136,7 @@ export class WebViewUtils {
144136
// and hand it out to any other functions that need to use it.
145137
acquireVsCodeApi: `const vscode = acquireVsCodeApi(); window.vscode = vscode;`,
146138
themeMap: themeMap as WebViewThemeMap,
147-
initialTheme: initialTheme ?? defaultInitialTheme,
139+
initialTheme,
148140
name,
149141
});
150142
return out;

test-workspace/vault/dendron.journal.2020.md

Whitespace-only changes.

0 commit comments

Comments
 (0)