Skip to content

Type System and React DOM Prop Mismatches in @xyflow/react Edge Components #631

Open
@m0nq

Description

@m0nq

What platform were you using when you found the bug?

  • React Flow version: @xyflow/react ^12.3.6
  • Browser: Chrome (latest)
  • OS: macOS Sequoia 15.2

Live code example

https://github.com/m0nq/cloud-people/blob/dev/mw/agent-node-states/src/components/sandbox-nodes/automation-edge.tsx

Describe the Bug

Hoping this is just something that I'm missing. Been trying to resolve this for 2 days.

Multiple prop type mismatches between @xyflow/react's TypeScript definitions and React DOM expectations:

  1. Boolean props are typed as boolean but React expects strings:
Error: Received `true` for a non-boolean attribute `animated`.
Error: Received `true` for a non-boolean attribute `selectable`.
Error: Received `true` for a non-boolean attribute `deletable`.
  1. Custom props not being properly handled by React DOM:
Error: React does not recognize the `sourceHandleId` prop on a DOM element.
Error: React does not recognize the `targetHandleId` prop on a DOM element.
Error: React does not recognize the `pathOptions` prop on a DOM element.

Steps to reproduce the bug or issue

  1. Create a custom edge component using BaseEdge
  2. Pass standard edge properties as defined in the type system:
const edge = {
    id: 'edge-1',
    source: 'node-1',
    target: 'node-2',
    animated: true,
    selectable: true,
    deletable: true,
    sourceHandleId: 'handle-1',
    targetHandleId: 'handle-2',
    pathOptions: {}
};

Expected behavior

  1. The type system should match the runtime expectations:
  • If React expects string attributes, props should be typed as strings
  • If props are meant to be boolean, React should handle them as booleans
  1. Custom props should be properly handled or stripped before reaching React DOM

Screenshots or Videos

Screenshot 2025-01-09 at 9 37 14 AM Screenshot 2025-01-09 at 9 38 25 AM Screenshot 2025-01-09 at 9 38 07 AM Screenshot 2025-01-09 at 9 37 55 AM Screenshot 2025-01-09 at 9 37 47 AM Screenshot 2025-01-09 at 9 37 35 AM Screenshot 2025-01-09 at 9 37 24 AM

Additional context

  • These warnings appear in development but don't prevent functionality
  • The type system suggests one usage while runtime requires another
  • Current workaround is to convert booleans to strings: animated: 'true' as any
  • This affects multiple edge properties consistently across the library
  • The issue is more noticeable when creating the first edge connection to a root node

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions