Skip to content

Conversation

@masenf
Copy link
Collaborator

@masenf masenf commented Oct 23, 2025

Might be more that we want to add based on testing.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 23, 2025

CodSpeed Performance Report

Merging #5925 will create unknown performance changes

Comparing masenf/more-auto-reload-errors (f8c43f9) with main (6b043d6)

Summary

⚠️ No benchmarks were detected in both the base of the PR and the PR.
Please ensure that your benchmarks are correctly instrumented with CodSpeed.

Check out the benchmarks creation guide

⏩ 8 skipped1

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.

Copy link
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.

Greptile Overview

Greptile Summary

Added the React error pattern "resolveDispatcher() is null" to the auto-reload error list in FrontendEventExceptionState. This error typically occurs when React hooks are called incorrectly or there's a React state synchronization issue.

  • Extends the existing auto-reload mechanism (introduced in #5922) to handle this additional error type
  • When detected, the page automatically reloads once per cooldown period to attempt recovery from transient state issues
  • Follows the same pattern as existing browser-specific null pointer errors (Chrome, Safari, Firefox)
  • No changes to the core auto-reload logic or cooldown mechanism

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a simple, low-risk addition of a single regex pattern to an existing list. It follows the exact same pattern as the three existing error matchers, uses proper regex escaping, and doesn't modify any logic. The auto-reload mechanism was thoroughly implemented in the previous PR (#5922), and this just extends the list of errors that trigger it.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
reflex/state.py 5/5 Added React dispatcher error pattern to auto-reload list for automatic recovery from transient errors

Sequence Diagram

sequenceDiagram
    participant Frontend as Frontend/React
    participant ErrorBoundary as ErrorBoundary
    participant State as FrontendEventExceptionState
    participant Browser as Browser Storage & Reload
    
    Frontend->>ErrorBoundary: Error: resolveDispatcher() is null
    ErrorBoundary->>State: handle_frontend_exception(info, stack)
    State->>State: Check if error matches auto_reload_on_errors patterns
    alt Error matches "resolveDispatcher() is null" pattern
        State->>Browser: Get last reload timestamp from sessionStorage
        alt Cooldown period expired
            State->>Browser: Update sessionStorage timestamp
            State->>Browser: window.location.reload()
            Browser->>Frontend: Page reloads
        else Within cooldown period
            State-->>ErrorBoundary: No action (skip reload)
        end
    else Error doesn't match patterns
        State->>ErrorBoundary: Show error fallback UI
    end
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@masenf masenf changed the title Reload on resolveDispatcher() is null more auto_reload_on_error patterns Oct 23, 2025
),
re.compile(re.escape("TypeError: null is not an object")), # Safari
re.compile(r"TypeError: can't access property \".*\" of null"), # Firefox
# Firefox: property access is on a function that returns null.
Copy link
Member

Choose a reason for hiding this comment

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

technically it's not a function, it just outputs whatever expression it was if it was not literally null

@masenf masenf merged commit f050374 into main Oct 27, 2025
46 of 47 checks passed
@masenf masenf deleted the masenf/more-auto-reload-errors branch October 27, 2025 17:22
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.

3 participants