perf: cache userSettings, improve #1013
This commit is contained in:
parent
55aff4778b
commit
d2ef57bcfa
3 changed files with 36 additions and 17 deletions
|
@ -11,15 +11,13 @@ export default defineNuxtPlugin(() => {
|
|||
innerHTML: `
|
||||
;(function() {
|
||||
const handle = localStorage.getItem('${STORAGE_KEY_CURRENT_USER_HANDLE}')
|
||||
if (!handle)
|
||||
return
|
||||
if (!handle) { return }
|
||||
const allSettings = JSON.parse(localStorage.getItem('${STORAGE_KEY_SETTINGS}') || '{}')
|
||||
const settings = allSettings[handle]
|
||||
if (!settings)
|
||||
return
|
||||
if (!settings) { return }
|
||||
|
||||
const html = document.querySelector('html')
|
||||
${process.dev ? 'console.log(\'settings\', settings)' : ''}
|
||||
${process.dev ? 'console.log({ settings })' : ''}
|
||||
|
||||
const { fontSize, language } = settings || {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue