Skip to content

fix: drop temporal=True from fetch_recent_blogs#6399

Merged
Kastier1 merged 1 commit intomainfrom
fix/recent-blogs-drop-temporal
Apr 27, 2026
Merged

fix: drop temporal=True from fetch_recent_blogs#6399
Kastier1 merged 1 commit intomainfrom
fix/recent-blogs-drop-temporal

Conversation

@Kastier1
Copy link
Copy Markdown
Contributor

@Kastier1 Kastier1 commented Apr 27, 2026

No description provided.

The Resources navbar dropdown's `blog_column` mounts during initial
render (via Radix navigation menu's pre-mounted panels). Its
`on_mount=RecentBlogsState.fetch_recent_blogs` races the WebSocket
handshake; with `temporal=True` the event is silently dropped if the
socket isn't yet connected, and `on_mount` doesn't refire — so the
column stays empty on slow connects. Without `temporal`, the event
queues and fires once the socket is up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Kastier1 Kastier1 requested a review from a team as a code owner April 27, 2026 23:53
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR removes temporal=True from the @rx.event decorator on fetch_recent_blogs, fixing a race condition where the event was silently dropped if the WebSocket hadn't yet connected when the Radix navigation menu pre-mounted the blog panel. Removing temporal=True allows the event to queue and fire once the socket is up, while background=True is preserved to avoid holding the state lock during the HTTP fetch.

Confidence Score: 5/5

Safe to merge — single-parameter removal that correctly resolves a documented race condition with no side-effects on the existing guard logic.

The change is a one-line removal of temporal=True. The _fetched guard prevents redundant fetches, background=True is retained so no state-lock regression occurs, and the fix is directly validated on staging. No new logic is introduced and no other code paths are affected.

No files require special attention.

Important Files Changed

Filename Overview
packages/reflex-site-shared/src/reflex_site_shared/backend/get_blogs.py Removes temporal=True from fetch_recent_blogs event decorator to prevent silent event drops when the WebSocket isn't yet connected at mount time; background=True is correctly preserved.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant RadixMenu as Radix Nav Menu
    participant WS as WebSocket
    participant Backend as RecentBlogsState

    Browser->>RadixMenu: Initial render
    RadixMenu->>Browser: Pre-mount blog_column panel (on_mount fires)
    Note over Browser,WS: WS handshake still in progress on slow connects

    alt temporal=True (old behavior)
        Browser->>WS: Enqueue fetch_recent_blogs
        WS-->>Browser: Event DROPPED (socket not yet connected)
        Note over Browser: Blog column stays empty — on_mount never refires
    else temporal=False (new behavior)
        Browser->>WS: Enqueue fetch_recent_blogs
        WS->>WS: Queue event until socket is ready
        WS->>Backend: Deliver fetch_recent_blogs
        Backend->>Backend: HTTP GET /recent-blogs (background task)
        Backend-->>Browser: State update: posts = [...]
        Browser->>Browser: Blog column renders cards
    end
Loading

Reviews (1): Last reviewed commit: "fix: drop temporal=True from fetch_recen..." | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 27, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing fix/recent-blogs-drop-temporal (c5203a5) with main (7b5d77e)

Open in CodSpeed

@Kastier1 Kastier1 merged commit 7a7a4d3 into main Apr 27, 2026
69 checks passed
@Kastier1 Kastier1 deleted the fix/recent-blogs-drop-temporal branch April 27, 2026 23:55
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.

2 participants