Don't mutate views when transforming queryUI to make API happy
This commit is contained in:
parent
963b3ae35c
commit
4d460c2a46
|
@ -6,16 +6,22 @@ import { dataFilters } from "@budibase/shared-core"
|
|||
function convertToSearchFilters(view) {
|
||||
// convert from SearchFilterGroup type
|
||||
if (view?.query) {
|
||||
view.queryUI = view.query
|
||||
view.query = dataFilters.buildQuery(view.query)
|
||||
return {
|
||||
...view,
|
||||
queryUI: view.query,
|
||||
query: dataFilters.buildQuery(view.query),
|
||||
}
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
||||
function convertToSearchFilterGroup(view) {
|
||||
if (view?.queryUI) {
|
||||
view.query = view.queryUI
|
||||
delete view.queryUI
|
||||
return {
|
||||
...view,
|
||||
query: view.queryUI,
|
||||
queryUI: undefined,
|
||||
}
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
|
|
@ -3,9 +3,12 @@ import { dataFilters } from "@budibase/shared-core"
|
|||
|
||||
function convertToSearchFilters(view) {
|
||||
// convert from SearchFilterGroup type
|
||||
if (view.query) {
|
||||
view.queryUI = view.query
|
||||
view.query = dataFilters.buildQuery(view.query)
|
||||
if (view?.query) {
|
||||
return {
|
||||
...view,
|
||||
queryUI: view.query,
|
||||
query: dataFilters.buildQuery(view.query),
|
||||
}
|
||||
}
|
||||
return view
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue