File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
compass-preferences-model/src Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ const editablePreferences: (keyof UserPreferences)[] = [
1313 'enableGenAISampleDocumentPassingOnAtlasProject' ,
1414 'enableGenAIFeaturesAtlasOrg' ,
1515 'enableGenAIFeaturesAtlasProject' ,
16+
17+ // Value can change from false to true during allocation / checking
18+ 'enableIndexesGuidanceExp' ,
19+ 'showIndexesGuidanceVariant' ,
1620] ;
1721
1822export class CompassWebPreferencesAccess implements PreferencesAccess {
@@ -27,9 +31,9 @@ export class CompassWebPreferencesAccess implements PreferencesAccess {
2731 savePreferences ( _attributes : Partial < UserPreferences > ) {
2832 // Only allow runtime updating certain preferences.
2933 if (
30- Object . keys ( _attributes ) . length == = 1 &&
31- editablePreferences . includes (
32- Object . keys ( _attributes ) [ 0 ] as keyof UserPreferences
34+ Object . keys ( _attributes ) . length > = 1 &&
35+ Object . keys ( _attributes ) . every ( ( attribute ) =>
36+ editablePreferences . includes ( attribute as keyof UserPreferences )
3337 )
3438 ) {
3539 return Promise . resolve ( this . _preferences . savePreferences ( _attributes ) ) ;
Original file line number Diff line number Diff line change @@ -273,9 +273,7 @@ const CompassWeb = ({
273273 onLog,
274274 onDebug,
275275 } ) ;
276-
277276 const preferencesAccess = useCompassWebPreferences ( initialPreferences ) ;
278-
279277 const initialWorkspaceRef = useRef ( initialWorkspace ) ;
280278 const initialWorkspaceTabsRef = useRef (
281279 initialWorkspaceRef . current ? [ initialWorkspaceRef . current ] : [ ]
@@ -296,6 +294,21 @@ const CompassWeb = ({
296294 preferences : preferencesAccess . current ,
297295 } ) ;
298296
297+ useEffect ( ( ) => {
298+ const updateEarlyIndexesPreferences = async ( ) => {
299+ await preferencesAccess . current . savePreferences ( {
300+ enableIndexesGuidanceExp : initialPreferences ?. enableIndexesGuidanceExp ,
301+ showIndexesGuidanceVariant :
302+ initialPreferences ?. showIndexesGuidanceVariant ,
303+ } ) ;
304+ } ;
305+ void updateEarlyIndexesPreferences ( ) ;
306+ } , [
307+ initialPreferences ?. enableIndexesGuidanceExp ,
308+ initialPreferences ?. showIndexesGuidanceVariant ,
309+ preferencesAccess ,
310+ ] ) ;
311+
299312 return (
300313 < GlobalAppRegistryProvider value = { appRegistry . current } >
301314 < AppRegistryProvider scopeName = "Compass Web Root" >
You can’t perform that action at this time.
0 commit comments