Wrap Recharts Sankey chart#6708
Conversation
Greptile SummaryThis PR wraps the Recharts
Confidence Score: 4/5Safe to merge after removing the link_width prop, which will silently do nothing at runtime. The packages/reflex-components-recharts/src/reflex_components_recharts/charts.py — the link_width field on SankeyChart should be removed. Important Files Changed
Reviews (2): Last reviewed commit: "Tighten Sankey data typing" | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e94c1102db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| data: Var[SankeyData] = field( | ||
| doc="The source data, including nodes and the weighted links between them." | ||
| ) |
There was a problem hiding this comment.
Accept State vars for Sankey data
With data typed as the exact SankeyData TypedDict, data=SankeyState.data is rejected before rendering when the State var is inferred or annotated as a normal mapping, which is exactly what the new stateful docs example does with its unannotated dict. Component._post_init checks a Var's _var_type against this prop hint, and a Mapping[...]/dict[...] State var is not a subclass of this TypedDict, so dynamic Sankey charts fail even though direct dict literals work. Use a less restrictive mapping-based prop type, or make the exact annotation part of the public API and docs.
Useful? React with 👍 / 👎.
Closes #6558
Summary
rx.recharts.SankeyChart/rx.recharts.sankey_chartTests
uv run pytest tests/units/components/graphing/test_recharts.py -quv run ruff check ...uv run ruff format --check ...uv run pyright ...