🐛 SearchInput filter result shows wrong items in UI, but console log is correct

Hi everyone,
I’m facing a strange issue in Frappe Studio related to a search input filter.

When I type something (for example “dh”), the console log shows the correct filtered result — only matching territories are displayed correctly in the log.
However, the UI list (the displayed result under the search box) shows a completely wrong item that doesn’t match the filter.

Here’s my code:

if (territory_search_input.value == "") {
  territoryList.value = Territory.data
  console.log('Empty search - showing all:', Territory.data)
} else {
  console.log('Search input:', territory_search_input.value)
  console.log('All territories:', Territory.data.map(t => t.territory))
  
  const filtered = Territory.data.filter(ter => {
    const match = ter.territory.toLowerCase().includes(
      territory_search_input.value.toLowerCase()
    )
    console.log(`"${ter.territory}" includes "${territory_search_input.value}"? ${match}`)
    return match
  })
  
  console.log('Filtered result:', filtered)
  territoryList.value = filtered
}

:jigsaw: Console Output (Correct)
Only Dhaka matches dh.

:jigsaw: UI Output (Wrong)
It shows another item (e.g., “Gulistan”) that doesn’t match the search term.

Screenshots:


:bulb: Question:
Why is the UI showing incorrect results even though the filtered array is correct in the console?
Is this a reactivity or Proxy issue in Frappe Studio?

Any help or suggestions would be appreciated :pray:

Ensure you have set the data key to the data item’s unique identifier if your list is rendered in a repeater.

Vue needs this to keep a track of each item in the rendered list: List Rendering | Vue.js

If it’s a list view, ensure you have set the rowKey prop

2 Likes