Skip to content

Commit

Permalink
Group Condition Filter not staying set #155
Browse files Browse the repository at this point in the history
Ensure group conditions are set correctly

resolves #155
  • Loading branch information
paustint committed Feb 26, 2023
1 parent 0050cb3 commit 7de5768
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions libs/ui/src/lib/expression-group/ExpressionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export const ExpressionContainer: FunctionComponent<ExpressionContainerProps> =
groupKey={row.key}
group={i + 1}
parentAction={expression.action}
rowAction={row.action}
onActionChange={(andOr) => handleGroupActionChange(andOr, row)}
onAddCondition={() => handleAddCondition(row)}
moveRowToGroup={moveRowToGroup}
Expand Down
5 changes: 3 additions & 2 deletions libs/ui/src/lib/expression-group/ExpressionGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ export interface ExpressionGroupProps {
groupKey: number;
group: number;
parentAction: AndOr;
rowAction: AndOr;
onActionChange: (value: AndOr) => void;
onAddCondition: () => void;
moveRowToGroup: (item: DraggableRow, targetGroup: number) => void;
children?: React.ReactNode;
}

export const ExpressionGroup: FunctionComponent<ExpressionGroupProps> = React.memo(
({ parentAction, groupKey, group, children, onActionChange, onAddCondition, moveRowToGroup }) => {
({ parentAction, rowAction, groupKey, group, children, onActionChange, onAddCondition, moveRowToGroup }) => {
const [{ isOver, canDrop }, drop] = useDrop({
accept: 'row',
collect: (monitor) => ({
Expand All @@ -42,7 +43,7 @@ export const ExpressionGroup: FunctionComponent<ExpressionGroupProps> = React.me
<span>{parentAction}</span>
<span className="slds-assistive-text">{`Condition Group ${group}`}</span>
</legend>
<ExpressionActionDropDown label="" value="AND" onChange={onActionChange} />
<ExpressionActionDropDown label="" value={rowAction || 'AND'} onChange={onActionChange} />
{children}
<div className="slds-expression__buttons">
<button className="slds-button slds-button_neutral" onClick={() => onAddCondition()}>
Expand Down

0 comments on commit 7de5768

Please sign in to comment.