You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Navigating between message threads with browser Back/Forward leaves openingThreadId stale and blocks MessagesPanel #4780
After #4777 (c9521d1), MessagesLayout in both apps/web/app/(ee)/partners.dub.co/(dashboard)/messages/layout.tsx and apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/layout.tsx tracks openingThreadId and loadedThreadId to hide the previous thread until the newly opened thread finishes loading:
However, openingThreadId is only updated when clicking a different item in MessagesList (if (group.id !== activeId) setOpeningThreadId(group.id)) or ProgramSelector / PartnerSelector, and the useEffect in layout.tsx only resets openingThreadId when !programSlug (!partnerId).
As a result:
If you open thread A (/messages/prog-a), click thread B (/messages/prog-b) in MessagesList (which sets openingThreadId = "prog-b" and loadedThreadId = "prog-b"), and then press the browser Back button to return to /messages/prog-a, openingThreadId stays "prog-b" while programSlug is "prog-a". showingOpenedThread evaluates to false, setLoadedThreadId("prog-a") never runs, MessagesPanel receives messages={undefined}, and showThreadSpinner (openingThreadId !== loadedThreadId) stays stuck if loadedThreadId ever differs.
Similarly, if you click thread B in MessagesList (setOpeningThreadId("prog-b")) and then click back on thread A before Next.js finishes changing activeId from "prog-a", group.id !== activeId is false so openingThreadId stays "prog-b" and the spinner overlay stays up indefinitely.
Syncing setOpeningThreadId(programSlug ?? null) (and setOpeningThreadId(partnerId ?? null)) in layout.tsx when the route param changes and setting setOpeningThreadId unconditionally on click in MessagesList / ProgramSelector / PartnerSelector fixes both cases.
Activity
linear commentedon Oct 24, 2026
ENG-1917
shafiktanbir commentedon Oct 24, 2026
I pushed a fix for this on my fork here since external PR creation is currently restricted to collaborators:
main...shafiktanbir:dub:fix/messages-opening-thread-id-sync
Happy to open the PR if access is enabled, or feel free to cherry-pick
fad0405.