From 03eec41a03aed550d658f7f791cfcffad7e6da63 Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:59:49 +0600 Subject: [PATCH] Change Special filter fix (#1990) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- .../view-resources/src/components/filter/FilterBar.svelte | 7 +++++++ .../src/components/filter/FilterSection.svelte | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/plugins/view-resources/src/components/filter/FilterBar.svelte b/plugins/view-resources/src/components/filter/FilterBar.svelte index 9a3cdcd822..efa9a92c06 100644 --- a/plugins/view-resources/src/components/filter/FilterBar.svelte +++ b/plugins/view-resources/src/components/filter/FilterBar.svelte @@ -59,6 +59,13 @@ ) } + $: clear(_class) + + function clear (_class: Ref>) { + filters.map((p) => p.onRemove?.()) + filters = [] + } + function remove (i: number) { filters[i]?.onRemove?.() filters.splice(i, 1) diff --git a/plugins/view-resources/src/components/filter/FilterSection.svelte b/plugins/view-resources/src/components/filter/FilterSection.svelte index b11a1c2518..99dfc4d17e 100644 --- a/plugins/view-resources/src/components/filter/FilterSection.svelte +++ b/plugins/view-resources/src/components/filter/FilterSection.svelte @@ -22,6 +22,7 @@ import { getClient } from '@anticrm/presentation' import task from '@anticrm/task' import type { State } from '@anticrm/task' + import { onDestroy } from 'svelte' export let _class: Ref> export let filter: Filter @@ -57,6 +58,10 @@ filter = filter dispatch('change') } + + onDestroy(() => { + filter.onRemove?.() + })