@@ -2,6 +2,7 @@ import React, { useCallback } from 'react';
22import type { UserConfigurablePreferences } from 'compass-preferences-model' ;
33import {
44 getSettingDescription ,
5+ getSettingSelectableValues ,
56 featureFlags ,
67} from 'compass-preferences-model/provider' ;
78import { settingStateLabels } from './state-labels' ;
@@ -18,6 +19,7 @@ import {
1819import { changeFieldValue } from '../../stores/settings' ;
1920import type { RootState } from '../../stores' ;
2021import { connect } from 'react-redux' ;
22+ import { get } from 'lodash' ;
2123
2224type KeysMatching < T , V > = keyof {
2325 [ P in keyof T as T [ P ] extends V ? P : never ] : P ;
@@ -170,6 +172,7 @@ function DropdownSetting<PreferenceName extends StringPreferences>({
170172 value : string | undefined ;
171173 disabled : boolean ;
172174} ) {
175+ selectableValues = JSON . parse ( JSON . stringify ( selectableValues ) ) ;
173176 const onChangeEvent = useCallback (
174177 ( event : React . ChangeEvent < HTMLSelectElement > ) => {
175178 onChange (
@@ -301,7 +304,7 @@ function SettingsInput({
301304
302305 const { name, type, onChange, value, selectableValues } = props ;
303306
304- console . log ( 'will we match' ) ;
307+ console . log ( 'will we match, ' , type ) ;
305308 if ( type === 'boolean' ) {
306309 input = (
307310 < BooleanSetting
@@ -312,7 +315,7 @@ function SettingsInput({
312315 />
313316 ) ;
314317 } else if ( type === 'string' && selectableValues ) {
315- console . log ( 'yay we matched' ) ;
318+ console . log ( 'yay we matched ' , selectableValues ) ;
316319 input = (
317320 < DropdownSetting
318321 name = { name }
@@ -362,11 +365,9 @@ const ConnectedSettingsInput = connect(
362365 const { name } = ownProps ;
363366 const { type } = getSettingDescription ( name ) ;
364367
365- console . log ( 'settings: ' , settings ) ;
366- console . log ( 'preferenceStates: ' , preferenceStates ) ;
367368 return {
368369 value : settings [ name ] ,
369- selectableValues : preferenceStates [ name ] ? .selectableValues ,
370+ selectableValues : getSettingSelectableValues ( name ) . selectableValues ,
370371 type : type ,
371372 disabled : ! ! preferenceStates [ name ] ,
372373 stateLabel : settingStateLabels [ preferenceStates [ name ] ?? '' ] ,
0 commit comments