Skip to content

fix(client-state): type global_set as the FunctionVar it returns - #7966

Open
benedikt-bartscher wants to merge 1 commit into
reflex-dev:mainfrom
benedikt-bartscher:fix/global-set-function-var
Open

benedikt-bartscher wants to merge 1 commit into
reflex-dev:mainfrom
benedikt-bartscher:fix/global-set-function-var

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

ClientStateVar.global_set returns a FunctionVar (.to(FunctionVar)), but it was annotated -> Var. Calling the setter therefore needed a second cast to type-check:

shared.global_set.call("from-plain-js")                   # pyright: Cannot access attribute "call" for class "Var[Unknown]"
shared.global_set.to(FunctionVar).call("from-plain-js")   # what callers had to write

The annotation is now -> FunctionVar. The client state playwright app called the setter with the extra .to(FunctionVar); it now calls .call(...) directly, which pyright rejects without the new annotation. No runtime change.

View guided diff

global_set builds its setter with `.to(FunctionVar)` but was annotated
`-> Var`, so calling it needed another `.to(FunctionVar)` to type-check.
The playwright test app called it that way; it now calls `.call(...)`
directly, which pyright rejects without the annotation.
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner November 22, 2026 14:47

@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

View guided diff | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Corrects ClientStateVar.global_set to return FunctionVar in its type annotation.

  • The global client-state setter now exposes its function type to callers.

Reviews (2) · Last reviewed commit: "fix(client-state): type global_set as th..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 22, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 14 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 146 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing benedikt-bartscher:fix/global-set-function-var (a897b03) with main (df7f157)

Open in CodSpeed

Footnotes

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

This branch has not been deployed

No deployments
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.

1 participant