fix hacks not applying immideately
This commit is contained in:
parent
f7fca3a1ba
commit
8958f70a48
2 changed files with 5 additions and 3 deletions
|
|
@ -42,6 +42,7 @@ export const createStyleSheet = (id, priority = 1000) => {
|
||||||
|
|
||||||
|
|
||||||
export const adoptStyleSheets = throttle(() => {
|
export const adoptStyleSheets = throttle(() => {
|
||||||
|
console.log('adopt')
|
||||||
if (supportsAdoptedStyleSheets) {
|
if (supportsAdoptedStyleSheets) {
|
||||||
document.adoptedStyleSheets = Object
|
document.adoptedStyleSheets = Object
|
||||||
.values(stylesheets)
|
.values(stylesheets)
|
||||||
|
|
@ -86,7 +87,7 @@ export const generateTheme = (inputRuleset, callbacks, debug) => {
|
||||||
|
|
||||||
const themes3 = init({
|
const themes3 = init({
|
||||||
inputRuleset,
|
inputRuleset,
|
||||||
debug: true
|
debug
|
||||||
})
|
})
|
||||||
|
|
||||||
getCssRules(themes3.eager, debug).forEach(rule => {
|
getCssRules(themes3.eager, debug).forEach(rule => {
|
||||||
|
|
@ -137,8 +138,7 @@ export const tryLoadCache = async () => {
|
||||||
eagerStyles.ready = true
|
eagerStyles.ready = true
|
||||||
lazyStyles.ready = true
|
lazyStyles.ready = true
|
||||||
|
|
||||||
// Don't do this, we need to wait until config adopts its styles first
|
adoptStyleSheets()
|
||||||
//adoptStyleSheets()
|
|
||||||
|
|
||||||
console.info(`Loaded theme from cache`)
|
console.info(`Loaded theme from cache`)
|
||||||
return true
|
return true
|
||||||
|
|
@ -253,6 +253,7 @@ export const applyConfig = (input) => {
|
||||||
|
|
||||||
const styleSheet = createStyleSheet('theme-holder', 30)
|
const styleSheet = createStyleSheet('theme-holder', 30)
|
||||||
|
|
||||||
|
styleSheet.clear()
|
||||||
styleSheet.addRule(`:root { ${rules} }`)
|
styleSheet.addRule(`:root { ${rules} }`)
|
||||||
|
|
||||||
// TODO find a way to make this not apply to theme previews
|
// TODO find a way to make this not apply to theme previews
|
||||||
|
|
|
||||||
|
|
@ -515,6 +515,7 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
async applyTheme (
|
async applyTheme (
|
||||||
{ recompile = false } = {}
|
{ recompile = false } = {}
|
||||||
) {
|
) {
|
||||||
|
console.log('Apply')
|
||||||
const {
|
const {
|
||||||
forceThemeRecompilation,
|
forceThemeRecompilation,
|
||||||
themeDebug,
|
themeDebug,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue