Skip to content

use deterministic hash for stateful component names#5525

Merged
adhami3310 merged 5 commits into
mainfrom
use-deterministic-hash-for-stateful-component-names
Jul 3, 2025
Merged

use deterministic hash for stateful component names#5525
adhami3310 merged 5 commits into
mainfrom
use-deterministic-hash-for-stateful-component-names

Conversation

@adhami3310
Copy link
Copy Markdown
Member

No description provided.

@adhami3310 adhami3310 linked an issue Jul 3, 2025 that may be closed by this pull request
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

Implements a deterministic hashing system for stateful component names in reflex/components/component.py to ensure consistent component identification across different builds and environments.

  • Added _deterministic_hash function to handle complex object types including components, vars, dicts, and enums
  • Modified StatefulComponent class to use deterministic hashing instead of MD5 string hashing
  • Enhanced hash calculation to maintain object structure integrity while processing nested data types

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment thread reflex/components/component.py Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 3, 2025

CodSpeed Performance Report

Merging #5525 will not alter performance

Comparing use-deterministic-hash-for-stateful-component-names (fda9fad) with main (898c446)

Summary

✅ 8 untouched benchmarks

Comment thread reflex/components/component.py Outdated
Comment on lines +511 to +512
if isinstance(value, float):
return _deterministic_hash(str(value))
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.

why not hash the float directly, like the int?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

_deterministic_hash has to return an int, so I'm not sure how to map it

@adhami3310 adhami3310 merged commit 398e1e6 into main Jul 3, 2025
40 of 41 checks passed
@adhami3310 adhami3310 deleted the use-deterministic-hash-for-stateful-component-names branch July 3, 2025 18:30
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.

Code changes triggers "no module update found"

2 participants