Skip to content

Commit

Permalink
Clean up double negative on disableField
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz committed Feb 9, 2021
1 parent 60644ad commit f16fd97
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,14 @@ export const RelevanceTuningLogic = kea<
},
toggleSearchField: ({ name, disableField }) => {
const { searchSettings } = values;
const { search_fields: searchFields } = searchSettings;

const searchFields = disableField
? omit(searchSettings.search_fields, name)
: { ...searchSettings.search_fields, [name]: { weight: 1 } };

actions.setSearchSettings({
...searchSettings,
boosts: searchSettings.boosts,
search_fields: {
...omit(searchFields, name),
...(!disableField && { [name]: { weight: 1 } }),
},
search_fields: searchFields,
});
},
updateFieldWeight: ({ name, weight }) => {
Expand All @@ -394,7 +393,6 @@ export const RelevanceTuningLogic = kea<

actions.setSearchSettings({
...searchSettings,
boosts: searchSettings.boosts,
search_fields: {
...searchFields,
[name]: {
Expand Down

0 comments on commit f16fd97

Please sign in to comment.