Skip to content

Commit

Permalink
fix(packages/core): For some users, the Themes selector may not be shown
Browse files Browse the repository at this point in the history
Fixes #6519
  • Loading branch information
starpit committed Jan 11, 2021
1 parent 91bbf05 commit 6218d15
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/core/src/webapp/themes/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,26 @@ export const switchToPersistedThemeChoice = async (): Promise<void> => {
debug('switching to persisted theme choice')
try {
await switchTo(theme, true)
return
} catch (err) {
debug('error switching to persisted theme choice, using default')
await switchTo(await getDefaultTheme(), true)
console.error('error switching to persisted theme choice', err)
// intentional fall-through
}
} else {
debug('no persisted theme choice')
await switchTo(await getDefaultTheme(), true)
// intentional fall-through
}
} catch (err) {
console.error('cannot find a theme', err)
// intentional fall-through
console.error('Error loading persisted theme choice', err)
}

// Here is the fall-through handler: switch to the default theme
// choice
try {
await switchTo(await getDefaultTheme(), true)
} catch (err) {
console.error('Critical error!!! Cannot find a theme.', err)
}
}

Expand Down

0 comments on commit 6218d15

Please sign in to comment.