Skip to content

fix(mobile): fix 100%-reproducible comments drawer crash#14516

Merged
dylanjeffers merged 2 commits into
mainfrom
fix/comments-drawer-crash
Jul 2, 2026
Merged

fix(mobile): fix 100%-reproducible comments drawer crash#14516
dylanjeffers merged 2 commits into
mainfrom
fix/comments-drawer-crash

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

Root cause: CommentBlockInternal called useCommentDrawer() to read closeAndExitNowPlaying, but @gorhom/bottom-sheet renders BottomSheetModal content via @gorhom/portal at a PortalHost that is a sibling of CommentDrawerContext.Provider in the React tree — not a descendant. So useCommentDrawer() received undefined context and threw every time any comment rendered. The ErrorBoundary caught it and showed the "Something went wrong" toast.

Fix: thread closeAndExitNowPlaying through CommentSectionContext (which is provided inside the portal content) instead. CommentDrawer sits inside CommentDrawerContext.Provider and safely reads the callback there, then passes it down via CommentSectionProvider.

Changes

  • packages/common/src/context/comments/commentsContext.tsx — add optional closeAndExitNowPlaying to CommentSectionProviderProps; expose in context value
  • packages/mobile/src/components/comments/CommentDrawer.tsx — call useCommentDrawer() at drawer level; forward closeAndExitNowPlaying into CommentSectionProvider
  • packages/mobile/src/components/comments/CommentBlock.tsx — remove useCommentDrawer() call; read from useCurrentCommentSection() with optional chaining

Test plan

  • Open comments drawer on any track — no "Something went wrong" toast
  • Tap a user avatar/link inside a comment — navigates correctly and both drawers close
  • Tap a @mention inside a comment — same
  • 0-comment track: drawer opens with empty state, compose input works

dylanjeffers and others added 2 commits July 1, 2026 10:21
…ivity

Profile pages use a collapsible tab view (horizontal pager + vertical
scroll). The global native-stack option `fullScreenGestureEnabled: true`
makes the swipe-to-pop recognizer span the entire screen, so a slightly
diagonal vertical scroll gets hijacked as a back gesture and the list
fails to scroll. The feed is unaffected because it is a root tab screen
with no back-swipe competing for the gesture.

Set `fullScreenGestureEnabled: false` on the Profile screen so swipe-back
is edge-only, letting mid-screen scrolling reach the list. Mirrors the
existing treatment on the Chat screen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gorhom/portal renders portal content at a PortalHost that is a sibling
of {children} in BottomSheetModalProvider's inner PortalProvider tree —
NOT a descendant.  This means CommentDrawerContext.Provider (which lives
inside {children}) is absent from the ancestor chain when the BottomSheet
content renders.

CommentBlockInternal was calling useCommentDrawer() to obtain
closeAndExitNowPlaying.  Because CommentDrawerContext is unreachable from
the portal render location, useCommentDrawer() threw
"useCommentDrawer must be used within a CommentDrawerProvider" every time
any comment rendered, which the ErrorBoundary caught and surfaced as the
"Something went wrong" toast.

Fix: thread closeAndExitNowPlaying through CommentSectionContext (which IS
provided inside the portal content by CommentSectionProvider) rather than
reading it directly from CommentDrawerContext in CommentBlockInternal.

- packages/common: add optional closeAndExitNowPlaying prop to
  CommentSectionProviderProps and expose it in CommentSectionContext
- CommentDrawer: call useCommentDrawer() at the CommentDrawer level
  (which IS inside CommentDrawerContext.Provider) and forward the
  callback into CommentSectionProvider
- CommentBlock: remove useCommentDrawer() call; read closeAndExitNowPlaying
  from useCurrentCommentSection() with optional chaining

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f2721b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dylanjeffers dylanjeffers merged commit fc430da into main Jul 2, 2026
5 checks passed
@dylanjeffers dylanjeffers deleted the fix/comments-drawer-crash branch July 2, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant