Skip to content

Commit

Permalink
variable naming update
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrtj committed Sep 27, 2024
1 parent 4bafe20 commit c65579c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const SeriesControls: FC<PropsWithChildren<SeriesControlsProps>> = ({

// Merge the default config with the one from the local storage
const resultFieldsConfig = useMemo(() => {
const defaultFieldConfig = getDefaultFieldConfig(
const resultFieldConfig = getDefaultFieldConfig(
entityControls,
!storageFieldsConfig
? true
Expand All @@ -153,17 +153,17 @@ export const SeriesControls: FC<PropsWithChildren<SeriesControlsProps>> = ({
);

// Early return to prevent unnecessary looping through the default config
if (!storageFieldsConfig) return defaultFieldConfig;
if (!storageFieldsConfig) return resultFieldConfig;

// Override only the fields properties stored in the local storage
for (const key of Object.keys(defaultFieldConfig) as MlEntityFieldType[]) {
defaultFieldConfig[key] = {
...defaultFieldConfig[key],
for (const key of Object.keys(resultFieldConfig) as MlEntityFieldType[]) {
resultFieldConfig[key] = {
...resultFieldConfig[key],
...storageFieldsConfig[key],
} as UiPartitionFieldConfig;
}

return defaultFieldConfig;
return resultFieldConfig;
}, [entityControls, storageFieldsConfig]);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function getFieldAgg(
const sortByField =
fieldConfig?.sort?.by === 'name' || isModelPlotSearch ? '_key' : 'maxRecordScore';

const filterValues = Object.entries(fieldsConfig ?? {})
const splitFieldFilterValues = Object.entries(fieldsConfig ?? {})
.filter(([key, field]) => key !== fieldType && field.value)
.map(([key, field]) => ({
fieldValueKey: `${key}_value`,
Expand Down Expand Up @@ -85,9 +85,9 @@ function getFieldAgg(
},
]
: []),
...filterValues.map((filter) => ({
...splitFieldFilterValues.map((filterValue) => ({
term: {
[filter.fieldValueKey]: filter.fieldValue,
[filterValue.fieldValueKey]: filterValue.fieldValue,
},
})),
],
Expand Down

0 comments on commit c65579c

Please sign in to comment.