Skip to content

add generic field to get_state in proxy#5415

Merged
masenf merged 1 commit into
mainfrom
khaleel/eng-6131-get_state-annotation-should-reflect-the-fact-that-it-returns
Jun 6, 2025
Merged

add generic field to get_state in proxy#5415
masenf merged 1 commit into
mainfrom
khaleel/eng-6131-get_state-annotation-should-reflect-the-fact-that-it-returns

Conversation

@adhami3310
Copy link
Copy Markdown
Member

fix #5414

@linear
Copy link
Copy Markdown

linear Bot commented Jun 6, 2025

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

Enhanced type safety in StateProxy's get_state method by adding generic type hints, improving IDE support and static type checking capabilities.

  • Added T_STATE TypeVar bound to BaseState in reflex/istate/proxy.py to ensure get_state returns the exact passed state type
  • Added pyright-ignore comment to handle type checking limitations with wrapped return types

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

Comment thread reflex/istate/proxy.py
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 6, 2025

CodSpeed Performance Report

Merging #5415 will not alter performance

Comparing khaleel/eng-6131-get_state-annotation-should-reflect-the-fact-that-it-returns (b508339) with main (f6998de)

Summary

✅ 8 untouched benchmarks

Copy link
Copy Markdown
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

clutch 😎

@masenf masenf merged commit d22034a into main Jun 6, 2025
41 checks passed
@masenf masenf deleted the khaleel/eng-6131-get_state-annotation-should-reflect-the-fact-that-it-returns branch June 6, 2025 05:01
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.

get_state annotation should reflect the fact that it returns an instance of the passed type

2 participants