Skip to content
Snippets Groups Projects
Commit 883db4e3 authored by Sjoerd's avatar Sjoerd Committed by Leonardo Christino
Browse files

fix(qb): duplicate node attribute in query builder error

parent 5af5fe33
No related branches found
No related tags found
1 merge request!286fix: duplicate node attribute in query builder error
Pipeline #140968 passed
...@@ -19,11 +19,7 @@ import { EntityPill } from '@graphpolaris/shared/lib/components/pills'; ...@@ -19,11 +19,7 @@ import { EntityPill } from '@graphpolaris/shared/lib/components/pills';
import { Handle, Position, useUpdateNodeInternals } from 'reactflow'; import { Handle, Position, useUpdateNodeInternals } from 'reactflow';
import { NodeAttribute, SchemaReactflowEntityNode, toHandleId } from '../../../model'; import { NodeAttribute, SchemaReactflowEntityNode, toHandleId } from '../../../model';
import { PillAttributes } from '../../pillattributes/PillAttributes'; import { PillAttributes } from '../../pillattributes/PillAttributes';
import { DropdownTrigger, DropdownContainer, DropdownItemContainer, DropdownItem } from '@graphpolaris/shared/lib/components/dropdowns'; import { uniqBy } from 'lodash-es';
import { PopoverContext } from '@graphpolaris/shared/lib/components/layout/Popover';
import { useDispatch } from 'react-redux';
import { isEqual } from 'lodash-es';
import { getDataTypeIcon } from '@graphpolaris/shared/lib/components/DataTypeIcon';
/** /**
* Component to render an entity flow element * Component to render an entity flow element
...@@ -43,6 +39,7 @@ export const QueryEntityPill = React.memo((node: SchemaReactflowEntityNode) => { ...@@ -43,6 +39,7 @@ export const QueryEntityPill = React.memo((node: SchemaReactflowEntityNode) => {
[graph], [graph],
); );
const uniqueAttributes = useMemo(() => uniqBy(data.attributes, (attr) => attr.handleData.attributeName), [data.attributes]);
const unionType = useQuerybuilderUnionTypes()[node.id]; const unionType = useQuerybuilderUnionTypes()[node.id];
return ( return (
...@@ -75,7 +72,7 @@ export const QueryEntityPill = React.memo((node: SchemaReactflowEntityNode) => { ...@@ -75,7 +72,7 @@ export const QueryEntityPill = React.memo((node: SchemaReactflowEntityNode) => {
{data?.attributes && ( {data?.attributes && (
<PillAttributes <PillAttributes
node={node} node={node}
attributes={data.attributes} attributes={uniqueAttributes}
attributeEdges={attributeEdges.map((edge) => edge?.attributes)} attributeEdges={attributeEdges.map((edge) => edge?.attributes)}
unionType={unionType} unionType={unionType}
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment