UBERF-4195: fix query after applying viewOptions (#3942)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov
2023-11-10 14:09:38 +07:00
committed by GitHub
parent 67a563d6c7
commit f8cdaba5f2
5 changed files with 115 additions and 8 deletions
@@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Class, Doc, DocumentQuery, Ref, Space, WithLookup } from '@hcengineering/core'
import { Class, Doc, DocumentQuery, mergeQueries, Ref, Space, WithLookup } from '@hcengineering/core'
import { IntlString, getEmbeddedLabel } from '@hcengineering/platform'
import { createQuery } from '@hcengineering/presentation'
import { Project, ProjectType, ProjectTypeCategory } from '@hcengineering/task'
@@ -65,7 +65,7 @@
$: spacesQ.query(task.class.Project, { type: mode as Ref<ProjectType> }, (result) => {
spaces = result
})
let resultQuery: DocumentQuery<Doc>
$: query = { ...(baseQuery ?? {}), ...(viewlet?.baseQuery ?? {}), space: { $in: spaces.map((it) => it._id) } }
$: searchQuery = search === '' ? query : { ...query, $search: search }
$: resultQuery = searchQuery
@@ -154,7 +154,7 @@
query={searchQuery}
{viewOptions}
on:change={(e) => {
resultQuery = { ...query, ...e.detail }
resultQuery = mergeQueries(query, e.detail)
}}
/>
<Component
@@ -22,6 +22,7 @@
DocumentUpdate,
FindOptions,
generateId,
mergeQueries,
Ref
} from '@hcengineering/core'
import { Item, Kanban as KanbanUI } from '@hcengineering/kanban'
@@ -87,7 +88,7 @@
}
let resultQuery: DocumentQuery<any> = { ...query }
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = { ...p, ...query }))
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = mergeQueries(p, query)))
const client = getClient()
const hierarchy = client.getHierarchy()