Skip to content

Commit

Permalink
fix: CLIN-2916 fix saving custom filter after adding saved custom pil…
Browse files Browse the repository at this point in the history
…l to it
  • Loading branch information
meek0 committed Aug 7, 2024
1 parent ecf75d6 commit 8067dcd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions packages/ui/Release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 10.4.6-rc4 2024-08-07
- fix: CLIN-2916 saving custom filter after adding saved custom pill to it

### 10.4.5 2024-08-05
- feat: FLUI-138 add sentry local storage integration

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ferlab/ui",
"version": "10.4.5",
"version": "10.4.6-rc4",
"description": "Core components for scientific research data portals",
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { isEmpty } from 'lodash';
import { get, isEmpty } from 'lodash';
import { v4 } from 'uuid';

import { BooleanOperators, RangeOperators, TermOperators } from '../../../data/sqon/operators';
Expand All @@ -17,6 +17,7 @@ import {
getDefaultSyntheticSqon,
getUpdatedActiveQuery,
getUpdatedActiveQueryByFilterGroup,
isBooleanOperator,
removeFieldFromActiveQuery,
} from '../../../data/sqon/utils';
import { IFilter, IFilterGroup } from '../../filters/types';
Expand Down Expand Up @@ -215,7 +216,11 @@ export const removePillFromQueryBuilder = (pillId: string, queryBuilderId: strin

export const addPillToQueryBuilder = (pill: IValueQuery, queryBuilderId: string): void => {
const activeQuery = getActiveQuery(queryBuilderId);
updateQuery({ query: { ...activeQuery, content: [...activeQuery.content, pill] }, queryBuilderId });
let newPill = pill;
if (isBooleanOperator(pill) && pill.content.length === 1) {
newPill = { ...pill, content: get(pill.content[0], 'content', []) };
}
updateQuery({ query: { ...activeQuery, content: [...activeQuery.content, newPill] }, queryBuilderId });
};

/**
Expand Down

0 comments on commit 8067dcd

Please sign in to comment.