From a38d9e56639c861bf8a157ab8049f9a25642c936 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 22 Mar 2026 07:21:10 -0700 Subject: [PATCH] fix(settings): search prefs review fixes - add try/except to suggest endpoint - use immutable spread/filter in addTag, removeTag, acceptSuggestion - add toggleBoard store action, remove direct v-model on board.enabled --- dev-api.py | 7 +++++-- web/src/stores/settings/search.ts | 17 +++++++++++------ web/src/views/settings/SearchPrefsView.vue | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/dev-api.py b/dev-api.py index 331d694..1e3b968 100644 --- a/dev-api.py +++ b/dev-api.py @@ -1137,5 +1137,8 @@ def save_search_prefs(payload: SearchPrefsPayload): @app.post("/api/settings/search/suggest") def suggest_search(body: dict): - # Stub — LLM suggest for paid tier - return {"suggestions": []} + try: + # Stub — LLM suggest for paid tier + return {"suggestions": []} + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) diff --git a/web/src/stores/settings/search.ts b/web/src/stores/settings/search.ts index 09b2d47..bd8f0a2 100644 --- a/web/src/stores/settings/search.ts +++ b/web/src/stores/settings/search.ts @@ -91,30 +91,35 @@ export const useSearchStore = defineStore('settings/search', () => { const arr = { job_titles, locations, exclude_keywords, custom_board_urls, blocklist_companies, blocklist_industries, blocklist_locations }[field] const trimmed = value.trim() if (!trimmed || arr.value.includes(trimmed)) return - arr.value.push(trimmed) + arr.value = [...arr.value, trimmed] } function removeTag(field: 'job_titles' | 'locations' | 'exclude_keywords' | 'custom_board_urls' | 'blocklist_companies' | 'blocklist_industries' | 'blocklist_locations', value: string) { const arr = { job_titles, locations, exclude_keywords, custom_board_urls, blocklist_companies, blocklist_industries, blocklist_locations }[field] - const idx = arr.value.indexOf(value) - if (idx !== -1) arr.value.splice(idx, 1) + arr.value = arr.value.filter(v => v !== value) } function acceptSuggestion(type: 'title' | 'location', value: string) { if (type === 'title') { - if (!job_titles.value.includes(value)) job_titles.value.push(value) + if (!job_titles.value.includes(value)) job_titles.value = [...job_titles.value, value] titleSuggestions.value = titleSuggestions.value.filter(s => s !== value) } else { - if (!locations.value.includes(value)) locations.value.push(value) + if (!locations.value.includes(value)) locations.value = [...locations.value, value] locationSuggestions.value = locationSuggestions.value.filter(s => s !== value) } } + function toggleBoard(name: string) { + job_boards.value = job_boards.value.map(b => + b.name === name ? { ...b, enabled: !b.enabled } : b + ) + } + return { remote_preference, job_titles, locations, exclude_keywords, job_boards, custom_board_urls, blocklist_companies, blocklist_industries, blocklist_locations, titleSuggestions, locationSuggestions, loading, saving, saveError, loadError, - load, save, suggestTitles, suggestLocations, addTag, removeTag, acceptSuggestion, + load, save, suggestTitles, suggestLocations, addTag, removeTag, acceptSuggestion, toggleBoard, } }) diff --git a/web/src/views/settings/SearchPrefsView.vue b/web/src/views/settings/SearchPrefsView.vue index 03ee58e..b4bcb73 100644 --- a/web/src/views/settings/SearchPrefsView.vue +++ b/web/src/views/settings/SearchPrefsView.vue @@ -77,7 +77,7 @@

Job Boards