Fix states search (#978)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-02-08 23:55:19 +07:00 committed by GitHub
parent 149aed9e34
commit ce99f9051e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,7 @@
(res) => (doneStates = res) (res) => (doneStates = res)
) )
async function updateQuery (): Promise<void> { async function updateQuery (search: string, selectedDoneStates: Set<Ref<DoneState>>): Promise<void> {
updateConfig() updateConfig()
const result = {} as DocumentQuery<Task> const result = {} as DocumentQuery<Task>
if (search !== '') { if (search !== '') {
@ -84,10 +84,10 @@
selectedDoneStates.add(id) selectedDoneStates.add(id)
} }
selectedDoneStates = selectedDoneStates selectedDoneStates = selectedDoneStates
updateQuery() updateQuery(search, selectedDoneStates)
} }
$: updateQuery() $: updateQuery(search, selectedDoneStates)
</script> </script>
<div class="flex-between mb-4 header"> <div class="flex-between mb-4 header">
@ -99,7 +99,7 @@
doneStatusesView = false doneStatusesView = false
state = undefined state = undefined
selectedDoneStates.clear() selectedDoneStates.clear()
updateQuery() updateQuery(search, selectedDoneStates)
}} }}
> >
<Label label={plugin.string.AllStates} /> <Label label={plugin.string.AllStates} />
@ -111,7 +111,7 @@
doneStatusesView = true doneStatusesView = true
state = undefined state = undefined
selectedDoneStates.clear() selectedDoneStates.clear()
updateQuery() updateQuery(search, selectedDoneStates)
}} }}
> >
<Label label={plugin.string.DoneStates} /> <Label label={plugin.string.DoneStates} />
@ -140,7 +140,7 @@
</div> </div>
{/each} {/each}
{:else} {:else}
<StatesBar bind:state {space} on:change={updateQuery} /> <StatesBar bind:state {space} on:change={() => updateQuery(search, selectedDoneStates)} />
{/if} {/if}
</div> </div>
</div> </div>