Skip to content

fix: unblock hung Log Out and Mingo archive TypeError - #292

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixmodals-unblock-hung-log-out-and-845e4a
Draft

posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixmodals-unblock-hung-log-out-and-845e4a

Conversation

@posthog

@posthog posthog Bot commented Aug 26, 2026

Copy link
Copy Markdown

Problem

  • Two confirmation modals never settle — a user who confirms Log Out stays signed in behind a spinner that never stops, and a user who archives a Mingo chat gets a raw TypeError banner instead of the archive.
  • Log Out (P1, session hygiene). An explicit sign-out silently leaves the session live, which matters on a shared machine in a tool that grants remote device control. Reproduced in a real session recording: confirm → ~3 minutes of nothing → back on /dashboard, still authenticated.
  • Mingo archive. The broken helper backs all four dialog operations: archive, unarchive, rename, and the archived-list fetch — so every GraphQL-level failure surfaces as Cannot read properties of null (reading 'archiveDialog') instead of the server's reason.

Root cause

Defect Mechanism
Hung logout logoutAsync fired fetch with no timeout and no AbortController; performLogout awaited it before clearing local state or redirecting. A hung request never rejects, so the catch never runs and isPending stays true forever.
Mingo TypeError runDialogMutation and the archived-list fetch read response.data.data[key] without checking the GraphQL errors array or a null data. A failed mutation returns HTTP 200 with data: null, so the code dereferences null.

Changes

  • Bound the logout call. An AbortController aborts the fetch after 5 s. On timeout the fetch rejects, logoutAsync returns false, and performLogout runs its existing teardown and redirect regardless of the server result.
  • Guard the GraphQL response. Both Mingo helpers now check response.data.errors first and surface the server's message, then guard data before indexing it — matching the existing pattern in tickets/utils/graphql.ts and mingo/context/rest-items.tsx.

Verification

  • npm run type-check and npm run lint:biome pass on both changed files.
  • The logout symptom is a hang, not a visual glitch: the fix is a timeout on the awaited call, so the modal's existing teardown path always runs.

Created with PostHog Desktop from this inbox report.

Two confirmation modals never settled.

Log Out: `logoutAsync` fired a `fetch` with no timeout, and `performLogout`
awaited it before it cleared local state or redirected. A hung request never
rejected, so the modal spinner stayed forever and the session stayed live.
Bound the call with an AbortController timeout so sign-out always proceeds.

Mingo dialog helper: `runDialogMutation` and the archived-list fetch read
`response.data.data[key]` without checking the GraphQL `errors` array or a null
`data`. A failed mutation returns HTTP 200 with `data: null`, so the code threw
a raw TypeError. Check `errors` first and guard `data` before indexing it.

Generated-By: PostHog Desktop
Task-Id: 11ac13fe-6342-49cb-8ee3-48119bbee96e
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.

0 participants