Skip to content

Add deep equality for frontend Vars - #7208

Merged
masenf merged 5 commits into
reflex-dev:mainfrom
flcrom:fix/deep-equals-var
Sep 30, 2026
Merged

masenf merged 5 commits into
reflex-dev:mainfrom
flcrom:fix/deep-equals-var

Conversation

@flcrom

@flcrom flcrom commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Add Var.deep_equals() for structural frontend comparisons. It compiles to the single-purpose lodash.isequal package, so nested objects and arrays compare by value rather than JavaScript identity.

This covers the data-driven form use case in #7160, including object key order and nested mappings.

Testing

  • uv run pytest -q tests/units/test_var.py (239 passed)
  • uv run pytest -q tests/integration/tests_playwright/test_cond_match.py in dev and production: nested and reordered objects, arrays, nulls, type boundaries, reactive form edits and saves, and existing conditional rendering.
  • full unit suite in independent QA (9643 passed)
  • Ruff, Pyright, ty, and make_pyi in independent QA
  • differential Node checks against lodash.isEqual for objects, collections, typed values, sparse arrays, symbols, and cyclic graphs

The package is pinned to [email protected]. npm marks that package deprecated in favor of Node's util.isDeepStrictEqual, but its behavior matches the lodash-style semantics requested here and avoids adding all of lodash.

Review in cubic

@flcrom
flcrom requested a review from a team as a code owner September 19, 2026 04:03

@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 3 files

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds deep equality comparison for frontend variables.

The PR appears safe to merge, though the existing non-blocking browser coverage gap remains.

Findings

  1. P2 Comparison edge cases untested ▶

Summary

The PR adds Var.deep_equals() for structural frontend comparisons using a pinned lodash.isequal import, with unit and browser coverage. The latest changes restore development and production harness runs for the browser tests.

Reviews (4) · Last reviewed commit: "Restore dev and prod coverage for deep e..."

@codspeed

codspeed Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 4.44%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 146 untouched benchmarks
⏩ 17 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_state_access[read_inherited] 50.2 ms 52.5 ms -4.44%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing flcrom:fix/deep-equals-var (36d0e69) with main (5d969cc)

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. ↩

@greptile-apps

This comment has been minimized.

@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.

All reported issues were addressed across 1 file (changes from recent commits).

You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

@masenf masenf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks for the contribution, will bring back the AppHarnessProd parametrization, then bring this in.

@masenf masenf added the on deck PRs lined up to review / merge next label Sep 30, 2026
@masenf
masenf merged commit 9f9371d into reflex-dev:main Sep 30, 2026
144 of 145 checks passed
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.

4 participants