Skip to content

Commit

Permalink
Data explorer: keep filter and sorting when changing mode from raw to…
Browse files Browse the repository at this point in the history
… raw edit (#3658)

Co-authored-by: Stefano Ricci <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 15, 2024
1 parent 141167d commit 48b1358
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions common/model/query/query/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ const resetNotApplicableProps = (query) => {
return query
}

export const assocMode = (mode) =>
A.pipe(
A.assoc(keys.mode, mode),
assocFilter(defaults[keys.filter]),
assocSort(defaults[keys.sort]),
resetNotApplicableProps
)
export const assocMode = (mode) => (query) => {
const prevMode = getMode(query)
let queryUpdated = A.pipe(A.assoc(keys.mode, mode), resetNotApplicableProps)(query)
if (prevMode == modes.aggregate || mode === modes.aggregate) {
// changing mode from raw to aggregate or vice versa: reset filter and sort
queryUpdated = A.pipe(assocFilter(defaults[keys.filter]), assocSort(defaults[keys.sort]))(queryUpdated)
}
return queryUpdated
}

export const toggleMeasureAggregateFunction =
({ nodeDefUuid, aggregateFn }) =>
Expand Down

0 comments on commit 48b1358

Please sign in to comment.