Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions app/components/Filter/Panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const { t } = useI18n()
const isExpanded = shallowRef(false)
const showAllKeywords = shallowRef(false)
const filterText = computed({
get: () => props.filters.text,
set: value => emit('update:text', value),
})
Comment on lines +35 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use a defineModel('text') instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property comes from props.filters.text, so is defineModel('text') unnecessary?
If so, ListToolbar.vue would also need to be updated accordingly.

Referenced from

const filterValue = computed({
get: () => props.filter,
set: value => emit('update:filter', value),
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, I see.

yes, this is awkward prop drilling we need to fix at some point but not in this PR

const displayedKeywords = computed(() => {
const keywords = props.availableKeywords ?? []
return showAllKeywords.value ? keywords : keywords.slice(0, 20)
Expand Down Expand Up @@ -130,11 +135,6 @@ function getSecurityLabelKey(value: SecurityFilter): string {
return securityLabelKeys.value[value]
}
function handleTextInput(event: Event) {
const target = event.target as HTMLInputElement
emit('update:text', target.value)
}
// Compact summary of active filters for collapsed header using operator syntax
const filterSummary = computed(() => {
const parts: string[] = []
Expand Down Expand Up @@ -242,13 +242,12 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
<InputBase
id="filter-search"
type="text"
:value="filters.text"
v-model="filterText"
:placeholder="searchPlaceholder"
autocomplete="off"
class="w-full min-w-25"
size="medium"
no-correct
@input="handleTextInput"
/>
</div>

Expand Down
Loading