Skip to content

Commit

Permalink
fix: use type-guards
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik committed Oct 11, 2023
1 parent 09963c0 commit e642b4f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/react-components/ory/helpers/filter-flow-nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import {
FilterNodesByGroups,
filterNodesByGroups,
getNodeInputType,
isUiNodeAnchorAttributes,
isUiNodeImageAttributes,
isUiNodeInputAttributes,
isUiNodeScriptAttributes,
isUiNodeTextAttributes,
} from "@ory/integrations/ui"
import { JSX } from "react"

Expand Down Expand Up @@ -31,14 +35,13 @@ export const FilterFlowNodes = ({
<Node
node={node}
key={
// input node
"name" in node.attributes
isUiNodeInputAttributes(node.attributes)
? node.attributes.name
: // image node
"src" in node.attributes
: isUiNodeImageAttributes(node.attributes)
? node.attributes.src
: // anchor, text & script node
"id" in node.attributes
: isUiNodeAnchorAttributes(node.attributes) ||
isUiNodeTextAttributes(node.attributes) ||
isUiNodeScriptAttributes(node.attributes)
? node.attributes.id
: k
}
Expand Down

0 comments on commit e642b4f

Please sign in to comment.