fix: sync store.filters and store.query into SearchView local state after LLM populate
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:
parent
0919ebc76a
commit
b5779224b1
1 changed files with 13 additions and 1 deletions
|
|
@ -444,7 +444,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { useRoute } from 'vue-router'
|
||||||
import { MagnifyingGlassIcon, ExclamationTriangleIcon, BookmarkIcon } from '@heroicons/vue/24/outline'
|
import { MagnifyingGlassIcon, ExclamationTriangleIcon, BookmarkIcon } from '@heroicons/vue/24/outline'
|
||||||
import { useSearchStore } from '../stores/search'
|
import { useSearchStore } from '../stores/search'
|
||||||
|
|
@ -623,6 +623,18 @@ const DEFAULT_FILTERS: SearchFilters = {
|
||||||
|
|
||||||
const filters = reactive<SearchFilters>({ ...DEFAULT_FILTERS })
|
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() {
|
function resetFilters() {
|
||||||
Object.assign(filters, DEFAULT_FILTERS)
|
Object.assign(filters, DEFAULT_FILTERS)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue