Skip to content

fix missing value for mutable state field leading to shared field value#5416

Merged
adhami3310 merged 1 commit into
mainfrom
fix-missing-value-for-mutable-state-field-leading-to-shared-field-value
Jun 6, 2025
Merged

fix missing value for mutable state field leading to shared field value#5416
adhami3310 merged 1 commit into
mainfrom
fix-missing-value-for-mutable-state-field-leading-to-shared-field-value

Conversation

@adhami3310
Copy link
Copy Markdown
Member

this should fix the event actions

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Fixed a critical bug in state management where mutable default values were being incorrectly shared across instances of state fields in reflex/vars/base.py.

  • Added deep copy mechanism for mutable default values to ensure each state instance gets its own independent copy
  • Implemented type-based default value detection with immutability check to prevent shared references
  • Fixed potential memory leaks and unexpected behavior in event actions caused by shared mutable state

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 6, 2025

CodSpeed Performance Report

Merging #5416 will not alter performance

Comparing fix-missing-value-for-mutable-state-field-leading-to-shared-field-value (0907349) with main (d22034a)

Summary

✅ 8 untouched benchmarks

@adhami3310 adhami3310 merged commit 542ee70 into main Jun 6, 2025
41 checks passed
@adhami3310 adhami3310 deleted the fix-missing-value-for-mutable-state-field-leading-to-shared-field-value branch June 6, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants