fix: sync store.filters and store.query into SearchView local state after LLM populate
Some checks are pending
CI / Python tests (push) Waiting to run
CI / Frontend typecheck + tests (push) Waiting to run
Mirror / mirror (push) Waiting to run

After populateFromLLM() runs, the sidebar filter controls and search bar now
update to reflect the LLM-generated values. Adds two one-way watchers
(store.filters → local reactive, store.query → queryInput). Closes #39.
This commit is contained in:
pyr0ball 2026-04-14 12:08:18 -07:00
parent 0919ebc76a
commit b5779224b1

View file

@ -444,7 +444,7 @@
</template>
<script setup lang="ts">
import { ref, computed, reactive, onMounted } from 'vue'
import { ref, computed, reactive, watch, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { MagnifyingGlassIcon, ExclamationTriangleIcon, BookmarkIcon } from '@heroicons/vue/24/outline'
import { useSearchStore } from '../stores/search'
@ -623,6 +623,18 @@ const DEFAULT_FILTERS: SearchFilters = {
const filters = reactive<SearchFilters>({ ...DEFAULT_FILTERS })
// Sync LLM-populated store state into the sidebar reactive and search bar.
// One-way only: store view. User edits in the sidebar stay local.
watch(
() => store.filters,
(newFilters) => { Object.assign(filters, newFilters) },
{ deep: true },
)
watch(
() => store.query,
(q) => { if (q) queryInput.value = q },
)
function resetFilters() {
Object.assign(filters, DEFAULT_FILTERS)
}