diff --git a/web/components/searches/button.tsx b/web/components/searches/button.tsx index 4e48c55..f8c8eac 100644 --- a/web/components/searches/button.tsx +++ b/web/components/searches/button.tsx @@ -51,7 +51,7 @@ const filterLabels: Record = { pref_age_max: "Max age", pref_age_min: "Min age", has_kids: "", - wants_kids_strength: "", + wants_kids_strength: "Kids", is_smoker: "", pref_relation_styles: "Seeking", pref_gender: "", @@ -93,7 +93,7 @@ function formatFilters(filters: Partial, location: locationType | const typedKey = key as keyof FilterFields if (value === undefined || value === null) return - if (typedKey == 'pref_age_min' || typedKey == 'pref_age_max' || typedKey == 'geodbCityIds') return + if (typedKey == 'pref_age_min' || typedKey == 'pref_age_max' || typedKey == 'geodbCityIds' || typedKey == 'orderBy') return if (Array.isArray(value) && value.length === 0) return if (initialFilters[typedKey] === value) return diff --git a/web/lib/supabase/searches.ts b/web/lib/supabase/searches.ts index 53ea020..6b062cb 100644 --- a/web/lib/supabase/searches.ts +++ b/web/lib/supabase/searches.ts @@ -3,6 +3,7 @@ import {db} from "web/lib/supabase/db"; import {filterKeys} from "web/components/questions-form"; import {track} from "web/lib/service/analytics"; import {FilterFields} from "web/components/filters/search"; +import {removeNullOrUndefinedProps} from "common/util/object"; export const getUserBookmarkedSearches = async (userId: string) => { @@ -29,7 +30,11 @@ export const submitBookmarkedSearch = async ( if (!filters) return if (!userId) return - const row = {search_filters: filters, location: locationFilterProps, creator_id: userId} + const row = { + search_filters: removeNullOrUndefinedProps(filters), + location: locationFilterProps?.location ? locationFilterProps : null, + creator_id: userId, + } const input = { ...filterKeys(row, (key, _) => !['id', 'created_time', 'last_notified_at'].includes(key)), } as BookmarkedSearchSubmitType