Skip to content

fix(events): cancel disconnected page-load chains - #7415

Merged
FarhanAliRaza merged 6 commits into
reflex-dev:mainfrom
kr1shna-exe:fix/7251-cancel-disconnected-page-loads
Oct 22, 2026
Merged

FarhanAliRaza merged 6 commits into
reflex-dev:mainfrom
kr1shna-exe:fix/7251-cancel-disconnected-page-loads

Conversation

@kr1shna-exe

@kr1shna-exe kr1shna-exe commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Page-load handlers keep running after their client disconnects, retaining state locks and repeatedly trying to send updates to a closed socket. Cancel that work when the current socket disconnects.

Closes #7251.

What changed

  • Cancel unfinished page-load chains, including self-chained descendants and queued hydration.
  • Check socket ownership so a stale disconnect cannot cancel a replacement connection's load. Preserve independent foreground and background events.
  • Add lifecycle regressions, page-load documentation and package news fragments. Raise the reflex-base dependency floor for the new processor hook.

Verification

  • 11,196 unit tests passed; 155 skipped; 78.99% coverage.
  • Ruff lint and format checks, pyright reflex tests and changed-file pre-commit hooks passed.
  • A real Socket.IO disconnect stopped a polling handler; independent background work completed and the same token reconnected successfully.
  • The reflex-base minimum-dependency check passed. Root dependency resolution fails on an existing hosting CLI/build SDK conflict. Full-repository pre-commit also hits six macOS benchmark typing errors. Both failures reproduce on clean upstream/main.

Deployment notes

No configuration changes. Page-load handlers and their chained events now receive cancellation on disconnect, matching navigation and reconnect behavior. Existing Redis cancellation-persistence behavior is unchanged and tracked separately in #7248.

Review in cubic

@kr1shna-exe
kr1shna-exe requested review from a team and Alek99 as code owners October 4, 2026 19:24

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

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Cancels unfinished hydration and page-load chains when their current client disconnects.

  • A client disconnect stops its unfinished page-load work.

Reviews (6) · Last reviewed commit: "Merge branch 'main' into fix/7251-cancel..." · Reviewed by Greptile

Comment thread packages/reflex-base/src/reflex_base/event/processor/base_state_processor.py Outdated
@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 11 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

✅ 148 untouched benchmarks


Comparing kr1shna-exe:fix/7251-cancel-disconnected-page-loads (519f568) with main (7f89e48)

Open in CodSpeed

@masenf masenf added bug Something isn't working documentation Improvements or additions to documentation labels Oct 6, 2026
@masenf masenf added the on deck PRs lined up to review / merge next label Oct 22, 2026
@FarhanAliRaza
FarhanAliRaza merged commit aefb36c into reflex-dev:main Oct 22, 2026
393 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation on deck PRs lined up to review / merge next

Projects

None yet

3 participants