File tree 2 files changed +15
-6
lines changed
packages/svelte-ux/src/lib/components
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte-ux " : patch
3
+ ---
4
+
5
+ Do not require ` settings() ` to be defined
Original file line number Diff line number Diff line change @@ -118,15 +118,19 @@ export function settings(settings: SettingsInput): Settings {
118
118
} ) ;
119
119
}
120
120
121
+ const FALLBACK_CONTEXT : Settings = {
122
+ currentTheme : createThemeStore ( { light : [ 'light' ] , dark : [ 'dark' ] } ) ,
123
+ componentSettingsCache : { } ,
124
+ ...createLocaleStores ( { } ) ,
125
+ } ;
126
+
121
127
export function getSettings ( ) : Settings {
122
- // in a try/catch to be able to test wo svelte components
128
+ // in a try/catch to be able to test w/o svelte components
129
+
123
130
try {
124
- return getContext < Settings > ( settingsKey ) ?? { } ;
131
+ return getContext < Settings > ( settingsKey ) ?? FALLBACK_CONTEXT ;
125
132
} catch ( error ) {
126
- return {
127
- currentTheme : createThemeStore ( { light : [ 'light' ] , dark : [ 'dark' ] } ) ,
128
- componentSettingsCache : { } ,
129
- } ;
133
+ return FALLBACK_CONTEXT ;
130
134
}
131
135
}
132
136
You can’t perform that action at this time.
0 commit comments