Skip to content

Fix Var._replace with _var_data - #7306

Merged
masenf merged 3 commits into
reflex-dev:mainfrom
flcrom:fix-var-replace-var-data
Sep 30, 2026
Merged

masenf merged 3 commits into
reflex-dev:mainfrom
flcrom:fix-var-replace-var-data

Conversation

@flcrom

@flcrom flcrom commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7256. Pop _var_data before forwarding replacement kwargs so dataclasses.replace does not receive it twice. Adds regression coverage for replacing VarData.

Review in cubic

@flcrom
flcrom requested a review from a team as a code owner September 24, 2026 10:16
@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Fixes a bug in the variable replacement method.

The PR appears safe to merge, with no new findings.

Summary

The PR fixes Var._replace(_var_data=...) by removing _var_data from forwarded keyword arguments, and adds regression coverage and a reflex-base news fragment.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into fix-var-replace..."

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@codspeed

codspeed Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 5.13%

⚡ 1 improved benchmark
✅ 146 untouched benchmarks
⏩ 17 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_state_access[read_cached_computed] 248.1 ms 236 ms +5.13%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing flcrom:fix-var-replace-var-data (d08dec0) with main (47187ef)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread tests/units/test_var.py Resolved
@masenf masenf added the on deck PRs lined up to review / merge next label Sep 30, 2026
@masenf
masenf merged commit f2b2f8c into reflex-dev:main Sep 30, 2026
145 of 146 checks passed
@masenf

masenf commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rx.Var.create(x)._replace(_var_data=...) raises "TypeError: dataclasses.replace() got multiple values for keyword argument '_var_data'"

2 participants