fix(mobile): guard comment components against undefined track from lineup cache#14493
fix(mobile): guard comment components against undefined track from lineup cache#14493dylanjeffers wants to merge 1 commit into
Conversation
…neup cache When the comment drawer is opened from a lineup/feed track tile, the track is hydrated from the partial lineup cache and can momentarily be undefined in the comment section context (which types `track` as always-present). Add an undefined-track guard in `CommentBlock` and optional-chain the `track` accesses in `CommentOverflowMenu` so the drawer doesn't crash on open with partial tile data. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Closing as redundant — CommentSectionProvider already returns null when track is undefined (commentsContext.tsx:230), so CommentBlock and CommentOverflowMenu as provider children can never see an undefined track. The underlying blank-drawer root cause was fixed in #14494, which gates the drawer itself on the loaded track. This PR's guards would be dead code. |
What
Hardens the comment-drawer components against an undefined
trackwhen the drawer is opened from a lineup/feed track tile (where the track is hydrated from the partial lineup cache, not the full track-screen fetch).CommentBlock: bail withif (!track) return nullbeforeCommentBlockInternaldereferencestrack.track_id/track.pinned_comment_id/track.duration.CommentOverflowMenu: optional-chain the contexttrackaccesses (track?.pinned_comment_id,track?.permalink).Why
The comment section context types
trackas always-present (track: Track) and the provider returnsnulluntil the track loads — so under normal flow these are safe. This is belt-and-suspenders hardening for the tile-open path, the same family as the already-merged crash fixes:CommentThread.rootComment.idComposerInput.partialTrack.access?.streamNote on the live RC crash
While investigating I found the current release-candidate branches (
release-client-v*, up to v1.5.164) do not contain #14490 or #14492 — both merged tomainon Jun 16–17. If testers are still crashing on the comment button, the most likely cause is that the RC build predates those fixes, independent of this PR. Worth confirming the RC's build commit / CodePush channel.Test plan
npx tsc --noEmit(packages/mobile) — cleannpx eslinton both files — clean🤖 Generated with Claude Code