1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix: apply theme on init

This commit is contained in:
Roman 2020-06-22 16:15:14 +03:00
parent 29197dcfb9
commit b4947999df
3 changed files with 27 additions and 14 deletions

View File

@ -141,7 +141,9 @@ export class ThemeStore {
}); });
// auto-apply colors to dom from active theme // auto-apply colors to dom from active theme
reaction(() => this.activeTheme, this.onChange); reaction(() => this.activeTheme, this.onChange, {
fireImmediately: true,
});
// apply theme from configuration // apply theme from configuration
import("./config.store").then(({ configStore }) => { import("./config.store").then(({ configStore }) => {
@ -184,6 +186,7 @@ export class ThemeStore {
try { try {
await this.load(themeId); await this.load(themeId);
this.activeThemeId = themeId; this.activeThemeId = themeId;
console.log('THEME', themeId, this.themes.get(themeId))
} catch (err) { } catch (err) {
if (themeId !== this.defaultTheme.name) { if (themeId !== this.defaultTheme.name) {
this.setTheme(); // fallback to default theme this.setTheme(); // fallback to default theme

View File

@ -26,6 +26,7 @@ export function webpackConfigReact(): webpack.Configuration {
}, },
output: { output: {
path: outDir, path: outDir,
publicPath: "/",
filename: '[name].js', filename: '[name].js',
chunkFilename: 'chunks/[name].js', chunkFilename: 'chunks/[name].js',
}, },
@ -100,7 +101,14 @@ export function webpackConfigReact(): webpack.Configuration {
{ {
test: /\.s?css$/, test: /\.s?css$/,
use: [ use: [
isDevelopment ? "style-loader" : MiniCssExtractPlugin.loader, {
// https://webpack.js.org/plugins/mini-css-extract-plugin/
loader: MiniCssExtractPlugin.loader,
options: {
hmr: isDevelopment, // fixme: doesn't work
reloadAll: true,
}
},
{ {
loader: "css-loader", loader: "css-loader",
options: { options: {
@ -127,13 +135,13 @@ export function webpackConfigReact(): webpack.Configuration {
plugins: [ plugins: [
new ForkTsCheckerPlugin(), new ForkTsCheckerPlugin(),
// detect circular dependencies // todo: fix remain warnings about circular dependencies
new CircularDependencyPlugin({ // new CircularDependencyPlugin({
cwd: __dirname, // cwd: __dirname,
exclude: /node_modules/, // exclude: /node_modules/,
allowAsyncCycles: true, // allowAsyncCycles: true,
failOnError: false, // failOnError: false,
}), // }),
// todo: check if this actually works in mode=production files // todo: check if this actually works in mode=production files
// new webpack.DllReferencePlugin({ // new webpack.DllReferencePlugin({

View File

@ -3535,7 +3535,7 @@ chokidar@^2.1.8:
optionalDependencies: optionalDependencies:
fsevents "^1.2.7" fsevents "^1.2.7"
chokidar@^3.4.0: chokidar@^3.0.2, chokidar@^3.4.0:
version "3.4.0" version "3.4.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.0.tgz#b30611423ce376357c765b9b8f904b9fba3c0be8"
integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ== integrity sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==
@ -4672,10 +4672,12 @@ electron-publish@22.7.0:
lazy-val "^1.0.4" lazy-val "^1.0.4"
mime "^2.4.5" mime "^2.4.5"
electron-serve@^1.0.0: electron-reload@^1.5.0:
version "1.0.0" version "1.5.0"
resolved "https://registry.yarnpkg.com/electron-serve/-/electron-serve-1.0.0.tgz#babf2f5022102fa300a841d91e4c2e7048ac4b1f" resolved "https://registry.yarnpkg.com/electron-reload/-/electron-reload-1.5.0.tgz#179ab1f6941fcf0ed261c37b16dc465e201348f5"
integrity sha512-Rsm4tjj1eK7NUWKgGw6NjHkjfB+bIXZh0ztybUYzqmwCm1wzb7zv95LERbwricDZfCsKHB0V57NgVvHdi2OOAQ== integrity sha512-L9X6LzsL3Bt2j0eJ4/MBrI9Vt902KvVUtBB7J4qrL1A9sXqC2fE0lpvUAlOThpJYh6zWO1l86U/YiEN9bDURHw==
dependencies:
chokidar "^3.0.2"
electron-store@^5.2.0: electron-store@^5.2.0:
version "5.2.0" version "5.2.0"