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
[$175] Attachment – Unable to Open Video in Thread Chat #106627
Version Number: v9.5.36-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail:https://github.com/Expensify/Expensify/issues/621188 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team
Action Performed:
Navigate to staging.new.expensify.com.
Open the app.
Send a video in any chat.
Change the playback speed to 2x.
Reply to the video to create a thread.
Open the thread and try to play the video.
Expected Result:
The video opens and plays in the thread.
Actual Result:
The video does not open in the thread chat.
Workaround:
N/A
Platforms:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
Screenshots/Videos
Bug7288611_1792194282519.bandicam_2026-10-17_02-39-18-183.mp4Upwork Automation - Do Not Edit
Verified app and chat access on dev NewDot web. Video reproduction is blocked: uploads are outside supported agent-device web capabilities, and the available chat contains no video.
Step
Status
1. Navigate to appConfirmed authenticated access to dev NewDot; staging was not tested.
✅
2. Open app/chatOpened Concierge and confirmed the message composer.
✅
3. Send a videoBlocked by unsupported upload automation, not an observed App failure. No existing video fixture was available.
❌
4. Change playback speed to 2xNot exercised because video setup was blocked.
❌
5. Reply to create a threadNot exercised because video setup was blocked.
❌
6. Open/play the original video in the thread — preliminary analysisConfidence: low; root cause remains unconfirmed.
Candidate mechanism: A newly mounted thread preview starts as a thumbnail. Desktop clicks update the globally selected video, but activation depends on that selection changing. If the same attachment is already selected when the thread mounts, clicking it may leave the thumbnail inactive. See VideoPlayerPreview/index.tsx:62–74 and 112–131.
Counterevidence: Parent-player cleanup clears the selected URL, which could prevent this failure. Its timing relative to thread mounting is unverified; see BaseVideoPlayer.tsx:428–440. The candidate also predicts possible failure at 1x, so it does not establish a speed-specific cause.
Required confirmation: Reproduce with an existing video at both 1x and 2x. At the failed click, check whether the thread still shows a thumbnail and whether the selected URL/report identity changes. If a player mounts successfully, investigate playback rather than thumbnail activation.
Recommendation: Do not implement a fix yet. Runtime reproduction and equivalence with the reported release remain unverified.
Please re-state the problem that we are trying to solve in this issue.
In a thread chat, tapping or clicking on an attached video preview fails to open the video modal/player or errors silently.
What is the root cause of that problem?
In AttachmentModal.tsx and ReportActionItemSingle.tsx / AttachmentView.tsx:
When rendering attachments within a thread report context, the parent reportID passed to the attachment modal resolver defaults to the active thread's reportID instead of resolving the original message's attachment source URL via the parent report action. The attachment source URL generation assumes standard 1:1 chat context, causing the video source URL resolver to encounter a missing source URI or invalid permissions token in thread view.
What changes do you think we should make in order to solve the problem?
In src/components/AttachmentModal.tsx and src/components/ReportActionItem/AttachmentView.tsx:
Ensure source and originalFileName resolution checks if the active report is a thread (ReportUtils.isChatThread(report)) and falls back to the parent report action's attachment URL with proper auth tokens.
In src/libs/actions/Report.ts (openReportAttachmentModal):
Pass the explicit reportActionID and parent reportID so the video player receives the fully qualified authenticated attachment URL.
What alternative solutions did you explore? (Optional)
Attempting to proxy attachment URLs without the auth token header, which fails for secure attachments.
Please re-state the problem that we are trying to solve in this issue.
When a user sends a video in a chat, plays the video inline (and optionally changes the playback speed to 2x), and then clicks Reply in thread to open the thread chat, clicking the Play button on the parent video thumbnail at the top of the thread does nothing—the video remains stuck on the thumbnail and never opens or plays.
What is the root cause of that problem?
How the video preview is rendered inside the thread header (00:08–00:14 of the QA recording):
In a chat thread (e.g. reportID = "487551176124257" created from parent chat reportID = "5409533764521432"), ReportActionItemParentAction (src/pages/inbox/report/ReportActionItemParentAction.tsx:61,123-144) uses useAncestors(report, ...) to render an <AncestorReportActionItem> for each ancestor.
getAncestors (src/libs/ReportUtils.ts:13117-13129) walks up parentReportID and populates ancestor.report with the parent report (5409533764521432).
AncestorReportActionItem (src/pages/inbox/report/AncestorReportActionItem.tsx:171-174) renders <ReportActionItem report={ancestorReport} action={ancestorReportAction} isThreadReportParentAction ... />, which passes reportID = ancestorReport.reportID ("5409533764521432") down through ActionContentRouter → ChatMessageContent (AttachmentContext.Provider value={{reportID, type: CONST.ATTACHMENT_TYPE.REPORT}}) → VideoRenderer → VideoPlayerPreview (src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx:44-47).
Consequently, the VideoPlayerPreview instance inside the thread view has reportID = "5409533764521432" (the parent report ID where the attachment belongs).
Why prevPlaybackKey in VideoPlayerPreview ignores the Play click in the thread:
When the user first plays the video in the parent chat (5409533764521432) and changes its playback speed to 2x, PlaybackContext sets:
currentlyPlayingURL = videoUrl
currentRouteReportID = "5409533764521432"
When the user then clicks Reply in thread, the app navigates to the thread report (487551176124257):
In PlaybackContext (src/components/VideoPlayerContexts/PlaybackContext/index.tsx:111-134), getCurrentRouteReportID(currentlyPlayingURL) sees that the focused route (487551176124257) is a chat thread (isChatThread(report) === true), calls findURLInReportOrAncestorAttachments(report, url), finds the video in the parent report's actions, and returns "5409533764521432" (and isURLStillMounted is also true because the parent screen stays mounted in the stack). Thus PlaybackContextdoes not reset, leaving currentlyPlayingURL === videoUrl and currentRouteReportID === "5409533764521432".
When the thread screen mounts its own VideoPlayerPreview for the parent action, isThumbnail initializes to useState(true), and prevPlaybackKey initializes to useState(playbackKey) where playbackKey is already: "${videoUrl}|5409533764521432|${videoUrl}|5409533764521432|false".
Because prevPlaybackKey === playbackKey on initial mount, the if (prevPlaybackKey !== playbackKey) block does not run on mount.
When the user clicks the Play button on the video thumbnail in the thread (00:08–00:13), handleOnPress calls updateCurrentURLAndReportID(videoUrl, report, "5409533764521432"). That sets currentlyPlayingURL to the exact same videoUrl and currentRouteReportID to the exact same "5409533764521432".
Neither currentlyPlayingURL nor currentRouteReportID changes (playbackKey is unchanged!), and handleOnPress never calls setIsThumbnail(false) directly on wide screens (!isSmallScreenWidth). As a result, isThumbnail stays true forever and BaseVideoPlayer never mounts!
What changes do you think we should make in order to solve the problem?
In handleOnPress, when on a wide layout (!isSmallScreenWidth), directly set setIsThumbnail(false) so pressing the thumbnail Play button always transitions the clicked VideoPlayerPreview from thumbnail to VideoPlayer even when currentlyPlayingURL and currentRouteReportID in PlaybackContext already match this videoUrl and reportID (such as when opening a thread after playing the parent video, or returning to a blurred screen where navigation.addListener('blur') reset isThumbnail to true while playbackKey remained unchanged):
Add a unit test in tests/unit/VideoPlayerPreviewTest.tsx verifying that when PlaybackContext already holds matching currentlyPlayingURL === videoUrl and currentRouteReportID === reportID at the time VideoPlayerPreview mounts (or after a navigation blur event resets isThumbnail to true), pressing the thumbnail on a wide screen (isSmallScreenWidth = false) transitions isThumbnail to false and renders VideoPlayer.
What alternative solutions did you explore? (Optional)
Initializing prevPlaybackKey to null (useState<string | null>(null)) so the if (prevPlaybackKey !== playbackKey) block also runs on mount: If prevPlaybackKey started as null, mounting the thread screen while the parent video was playing (or paused as the last active video) would immediately auto-replace the thumbnail and auto-play the video inside the thread header as soon as the user clicked "Reply in thread", even if the user only wanted to type a reply. Setting setIsThumbnail(false) inside handleOnPress (when !isSmallScreenWidth) keeps the thread header as a clean thumbnail on thread open and reliably mounts and plays VideoPlayer (inheriting the 2x currentPlaybackSpeed via VideoPopoverMenuContext.tsx:45-53) the moment the user clicks Play.
— submitted with Antigravity on the contributor's behalf
Please re-state the problem that we are trying to solve in this issue.
In a thread chat on desktop/web, clicking on an attached video thumbnail fails to mount and play the video player inline.
What is the root cause of that problem?
When clicking on a video thumbnail in a thread, handleOnPress in VideoPlayerPreview/index.tsx triggers updateCurrentURLAndReportID in PlaybackContext/index.tsx.
In PlaybackContext/index.tsx:58-65, when the active report is a thread (isChatThread(report) is true), it normalizes the report ID by looking up ancestor attachments:
Because reportID (thread report ID) does not match currentRouteReportID (parent report ID), the condition evaluates to false. Therefore, setIsThumbnail(false) is never called, and the preview remains permanently stuck in thumbnail mode without mounting the video player.
What changes do you think we should make in order to solve the problem?
In src/components/VideoPlayerPreview/index.tsx:
When verifying whether the active video matches the preview:
Check if reportID === currentRouteReportID OR if report is a chat thread whose parent/ancestor report matches currentRouteReportID (e.g. report?.parentReportID === currentRouteReportID or findURLInReportOrAncestorAttachments(report, videoUrl) === currentRouteReportID).
Alternatively, in VideoPlayerPreview/index.tsx, when invoking handleOnPress:
Pass the normalized report ID corresponding to the ancestor attachment context so that reportID passed to VideoPlayerPreview and currentRouteReportID in PlaybackContext stay consistent.
What alternative solutions did you explore? (Optional)
Bypassing the reportID === currentRouteReportID check entirely: Not recommended because multiple chats or search results may display the same video attachment, and we only want the focused instance to switch from thumbnail to active player.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/VideoPlayerPreviewTest.tsx:
Add a test verifying that when a video attachment is rendered inside a thread report context, triggering playback successfully switches isThumbnail to false and mounts the player.
There are two distinct root causes that combine to completely block video playback inside thread chats on desktop/web:
reportID mismatch between thread and normalized ancestor report in PlaybackContext:
In PlaybackContext/index.tsx:58-65, when updateCurrentURLAndReportID is called with a thread report (isChatThread(report) is true), setCurrentRouteReportID does not set the thread's own report ID. Instead, it resolves the ancestor report ID where the attachment originated via findURLInReportOrAncestorAttachments(report, url):
Because reportID (threadReport.reportID) does not equal currentRouteReportID (parentReport.reportID), this check evaluates to false. setIsThumbnail(false) is never called, leaving the video permanently trapped in thumbnail mode.
handleOnPress fails to transition isThumbnail and stale playbackKey state prevents re-evaluation:
On wide screens (!isSmallScreenWidth), clicking the thumbnail's play button is an explicit user intent to mount and play the video inline. However, handleOnPress does not call setIsThumbnail(false) directly; it delegates thumbnail toggling solely to the prevPlaybackKey !== playbackKey render check (VideoPlayerPreview/index.tsx:123-131).
When the user previously played the video in the parent chat (e.g., at 2x speed as described in Step 4), currentlyPlayingURL is already videoUrl, and currentRouteReportID is already parentReport.reportID.
When the user opens the thread and clicks the thumbnail, updateCurrentURLAndReportID(videoUrl, report, reportID) sets currentlyPlayingURL and currentRouteReportID to the exact same values they already held. Consequently, playbackKey does not change (prevPlaybackKey !== playbackKey evaluates to false), so the thumbnail state transition is never even triggered.
What changes do you think we should make in order to solve the problem?
1. In src/components/VideoPlayerPreview/index.tsx:
Directly set setIsThumbnail(false) in handleOnPress on wide screens (!isSmallScreenWidth), and update the playback matching condition to support thread reports whose ancestor attachment matches currentRouteReportID:
// 1. Imports in src/components/VideoPlayerPreview/index.tsx:import{findURLInReportOrAncestorAttachments}from'@components/VideoPlayerContexts/PlaybackContext/playbackContextReportIDUtils';import{isChatThread}from'@libs/ReportUtils';// 2. In handleOnPress: toggle thumbnail on wide screen:consthandleOnPress=()=>{updateCurrentURLAndReportID(videoUrl,report,reportID);if(isSmallScreenWidth){onShowModalPress();}else{setIsThumbnail(false);}};// 3. In the playbackKey transition check: support thread ancestor matching:if(prevPlaybackKey!==playbackKey){setPrevPlaybackKey(playbackKey);constisFocused=doesUserRemainOnFirstRenderRoute();constisMatchingReport=reportID===currentRouteReportID||(isChatThread(report)&&findURLInReportOrAncestorAttachments(report,videoUrl)===currentRouteReportID);if(videoUrl===currentlyPlayingURL&&isMatchingReport&&isFocused){setIsThumbnail(false);}}
What alternative solutions did you explore? (Optional)
Only setting setIsThumbnail(false) in handleOnPress without updating the playbackKey check:
While setting setIsThumbnail(false) directly in handleOnPress resolves the immediate user click, if playback is triggered externally or when navigating between related chats, the thumbnail would fail to activate because reportID === currentRouteReportID remains false for thread reports. Doing both ensures airtight reliability.
Normalizing currentRouteReportID inside VideoPlayerPreview props:
Passing the ancestor report ID into VideoPlayerPreview would break downstream components like VideoPlayer (src/components/VideoPlayer/index.tsx) and useReportActions which require the real reportID of the current screen to load comments and thread actions. Resolving isMatchingReport within VideoPlayerPreview preserves the integrity of reportID.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/VideoPlayerPreviewTest.tsx:
Verify that pressing the thumbnail on wide screen (isSmallScreenWidth: false) sets isThumbnail to false and renders VideoPlayer.
Verify that when VideoPlayerPreview is rendered inside a chat thread report (isChatThread(report) === true) and currentRouteReportID in PlaybackContext matches the parent report ID where the video originated, isMatchingReport resolves to true and activates the player.
Please re-state the problem that we are trying to solve in this issue.
On Web desktop (!isSmallScreenWidth), after sending and playing a video inline in a chat (and changing playback speed to 2x), clicking Reply in thread to open the thread and then clicking the Play button on the parent video thumbnail in the thread header does nothing—the attachment stays stuck as a thumbnail instead of mounting the inline video player and playing at 2x.
What is the root cause of that problem?
Parent video in a thread header shares the parent reportID, while ScreenFreezeWrapper on Web freezes the parent screen before BaseVideoPlayer can unmount and clear PlaybackContext:
Inside the thread screen, ReportActionItemParentAction (src/pages/inbox/report/ReportActionItemParentAction.tsx:61,123-126) resolves ancestors via useAncestors and renders <AncestorReportActionItem report={ancestorReport} ... /> (src/pages/inbox/report/AncestorReportActionItem.tsx:171-186), which passes reportID = ancestorReport.reportID (the parent chat's reportID, not the thread's reportID) down through ReportActionItem -> ActionContentRouter -> ChatMessageContent (AttachmentContext.Provider at src/pages/inbox/report/actionContents/ChatMessageContent.tsx:67,86) -> VideoRenderer -> VideoPlayerPreview (src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx:44-47).
When the user plays the video (and sets 2x speed) in the parent chat, PlaybackContext stores currentlyPlayingURL = videoUrl and currentRouteReportID = parentReportID.
When the user clicks Reply in thread, ReportsSplitNavigator (src/libs/Navigation/AppNavigator/createSplitNavigator/index.tsx:26) pushes the thread ReportScreen with nonTopScreenBehavior: 'freeze'.
On Native, ScreenFreezeWrapper (src/libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent/ScreenFreezeWrapper/index.native.tsx:13,30-35) delays setFrozen(true) by FREEZE_DELAY_MS = 500 ms + requestAnimationFrame so transitional UI updates flush first; VideoPlayerPreview's blur listener (setIsThumbnail(true)) commits, unmounting the parent BaseVideoPlayer and running its cleanup (setCurrentlyPlayingURL(null) at src/components/VideoPlayer/BaseVideoPlayer.tsx:428-440).
On Web, ScreenFreezeWrapper (src/libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent/ScreenFreezeWrapper/index.tsx:108-131) sets frozen = true in useLayoutEffect, suspending the covered parent ReportScreen inside <Freeze freeze={true}>before React Navigation's bluruseEffect listener (src/components/VideoPlayerPreview/index.tsx:119-121) can commit setIsThumbnail(true). Consequently, the parent BaseVideoPlayer remains mounted in the frozen tree and never clears currentlyPlayingURL (and PlaybackContext's route effect at src/components/VideoPlayerContexts/PlaybackContext/index.tsx:107-134 also preserves state because getCurrentRouteReportID resolves the thread's ancestor attachment back to parentReportID and mountedVideoPlayersRef still contains videoUrl). The same state retention occurs on wide layouts when a thread opens in RHP while the parent screen remains visible.
VideoPlayerPreview initializes prevPlaybackKey to the already-active playbackKey and handleOnPress never transitions isThumbnail when PlaybackContext state is unchanged:
In src/components/VideoPlayerPreview/index.tsx:62,112-131:
When the thread's VideoPlayerPreview mounts, currentlyPlayingURL is already videoUrl and currentRouteReportID is already parentReportID, so prevPlaybackKey initializes to the exact active playbackKey while isThumbnail initializes to true.
Clicking Play in the thread calls updateCurrentURLAndReportID(videoUrl, report, parentReportID), which writes the exact same currentlyPlayingURL and currentRouteReportID. Both useState setters bail out (Object.is), playbackKey never changes (prevPlaybackKey !== playbackKey stays false), and handleOnPress does not call setIsThumbnail(false) when !isSmallScreenWidth.
Hidden-player audio leak when the parent screen freezes mid-playback:
Because ScreenFreezeWrapper suspends the parent ReportScreen on Web before setIsThumbnail(true) can unmount the parent BaseVideoPlayer, if the parent video is still playing when the user opens the thread, VideoPlayerPreview's blur listener (line 120) never pauses it, updateCurrentURLAndReportID (src/components/VideoPlayerContexts/PlaybackContext/index.tsx:46-48) skips video.pause() because url === currentlyPlayingURLRef.current, and updateCurrentVideoPlayerRefs (src/components/VideoPlayerContexts/PlaybackContext/usePlaybackContextVideoRefs.ts:38-41) overwrites currentVideoPlayerRef.current with the thread player's ref without pausing the previous player instance—leaving the frozen parent <video> playing simultaneously in the background.
What changes do you think we should make in order to solve the problem?
Transition isThumbnail on wide-screen press and pause active playback on route blur in src/components/VideoPlayerPreview/index.tsx:
Destructure pauseVideo from usePlaybackActionsContext().
In handleOnPress, explicitly call setIsThumbnail(false) when !isSmallScreenWidth so clicking the thumbnail Play button always mounts VideoPlayer even when currentlyPlayingURL and currentRouteReportID already match videoUrl and reportID (once mounted, BaseVideoPlayer registers via shareVideoPlayerElements, updating originalParent and currentVideoPlayerRef, which triggers VideoPopoverMenuContext.tsx:45-53 to apply the stored 2xcurrentPlaybackSpeed):
In the navigation.addListener('blur', ...) effect, imperatively pause via pauseVideo() when this preview owns the active inline player and we are not opening the attachment modal (!isOnAttachmentRoute()), ensuring a ScreenFreezeWrapper-suspended parent <video> stops immediately even though its React state re-render is frozen until unfreeze:
Pause any previous distinct VideoPlayer instance before swapping refs in src/components/VideoPlayerContexts/PlaybackContext/usePlaybackContextVideoRefs.ts:
In updateCurrentVideoPlayerRefs (lines 38-41), if currentVideoPlayerRef.current && currentVideoPlayerRef.current !== playerRef, pause the outgoing player before overwriting currentVideoPlayerRef.current:
This guarantees two non-shared BaseVideoPlayer instances for the same URL (such as a frozen parent screen + thread screen, or central pane + RHP) can never play simultaneously.
Add unit tests in a new tests/unit/VideoPlayerPreviewTest.tsx file:
Verify that when VideoPlayerPreview mounts on a wide screen (isSmallScreenWidth = false) while PlaybackContext already holds currentlyPlayingURL === videoUrl and currentRouteReportID === reportID, pressing the thumbnail transitions isThumbnail to false and renders VideoPlayer.
Verify that firing the navigation blur event (when not on ROUTES.REPORT_ATTACHMENTS) calls pauseVideo() when the preview is the active inline player and resets isThumbnail to true.
Verify that updateCurrentVideoPlayerRefs pauses a previously registered distinct VideoPlayer instance when registering a new instance for the same video URL.
What alternative solutions did you explore? (Optional)
Initializing prevPlaybackKey to null so the render-phase prevPlaybackKey !== playbackKey check runs on initial mount: Rejected because opening a thread (or scrolling a second occurrence into view) while currentlyPlayingURL === videoUrl would immediately replace the thumbnail and auto-play the video in the thread header without the user clicking Play, even when the user only opened the thread to type a reply.
Adding isChatThread(report) && findURLInReportOrAncestorAttachments(...) inside VideoPlayerPreview: Unnecessary and ineffective here because AncestorReportActionItem already passes parentReport.reportID (isChatThread(report) === false) to VideoPlayerPreview, and for a video posted directly inside a thread (or nested thread), findURLInReportOrAncestorAttachments already returns that thread's own reportID matching reportID.
Activity
melvin-bot commentedon Nov 11, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @FitseTLT (
External)[-]Attachment – Unable to Open Video in Thread Chat[/-][+][$175] Attachment – Unable to Open Video in Thread Chat[/+]melvin-bot commentedon Nov 11, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022120507355921793494
MelvinBot commentedon Nov 11, 2026
🤖 Web test steps verification results:⚠️ partial
Verified app and chat access on dev NewDot web. Video reproduction is blocked: uploads are outside supported agent-device web capabilities, and the available chat contains no video.
1. Navigate to app
Confirmed authenticated access to dev NewDot; staging was not tested.2. Open app/chat
Opened Concierge and confirmed the message composer.3. Send a video
Blocked by unsupported upload automation, not an observed App failure. No existing video fixture was available.4. Change playback speed to 2x
Not exercised because video setup was blocked.5. Reply to create a thread
Not exercised because video setup was blocked.6. Open/play the original video in the thread — preliminary analysis
Confidence: low; root cause remains unconfirmed.Candidate mechanism: A newly mounted thread preview starts as a thumbnail. Desktop clicks update the globally selected video, but activation depends on that selection changing. If the same attachment is already selected when the thread mounts, clicking it may leave the thumbnail inactive. See VideoPlayerPreview/index.tsx:62–74 and 112–131.
Counterevidence: Parent-player cleanup clears the selected URL, which could prevent this failure. Its timing relative to thread mounting is unverified; see BaseVideoPlayer.tsx:428–440. The candidate also predicts possible failure at 1x, so it does not establish a speed-specific cause.
Required confirmation: Reproduce with an existing video at both 1x and 2x. At the failed click, check whether the thread still shows a thumbnail and whether the selected URL/report identity changes. If a player mounts successfully, investigate playback rather than thumbnail activation.
Recommendation: Do not implement a fix yet. Runtime reproduction and equivalence with the reported release remain unverified.
view run · no recording available
TassioSales commentedon Nov 11, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a thread chat, tapping or clicking on an attached video preview fails to open the video modal/player or errors silently.
What is the root cause of that problem?
In
AttachmentModal.tsxandReportActionItemSingle.tsx/AttachmentView.tsx:When rendering attachments within a thread report context, the parent
reportIDpassed to the attachment modal resolver defaults to the active thread'sreportIDinstead of resolving the original message's attachment source URL via the parent report action. The attachment source URL generation assumes standard 1:1 chat context, causing the video source URL resolver to encounter a missing source URI or invalid permissions token in thread view.What changes do you think we should make in order to solve the problem?
src/components/AttachmentModal.tsxandsrc/components/ReportActionItem/AttachmentView.tsx:sourceandoriginalFileNameresolution checks if the active report is a thread (ReportUtils.isChatThread(report)) and falls back to the parent report action's attachment URL with proper auth tokens.src/libs/actions/Report.ts(openReportAttachmentModal):reportActionIDand parentreportIDso the video player receives the fully qualified authenticated attachment URL.What alternative solutions did you explore? (Optional)
Attempting to proxy attachment URLs without the auth token header, which fails for secure attachments.
HindsightWise commentedon Nov 11, 2026
Contributor details
Your Expensify account email: hindsightwise@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~013d295f05a578824b
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user sends a video in a chat, plays the video inline (and optionally changes the playback speed to 2x), and then clicks Reply in thread to open the thread chat, clicking the Play button on the parent video thumbnail at the top of the thread does nothing—the video remains stuck on the thumbnail and never opens or plays.
What is the root cause of that problem?
How the video preview is rendered inside the thread header (
00:08–00:14of the QA recording):reportID = "487551176124257"created from parent chatreportID = "5409533764521432"),ReportActionItemParentAction(src/pages/inbox/report/ReportActionItemParentAction.tsx:61,123-144) usesuseAncestors(report, ...)to render an<AncestorReportActionItem>for each ancestor.getAncestors(src/libs/ReportUtils.ts:13117-13129) walks upparentReportIDand populatesancestor.reportwith the parent report (5409533764521432).AncestorReportActionItem(src/pages/inbox/report/AncestorReportActionItem.tsx:171-174) renders<ReportActionItem report={ancestorReport} action={ancestorReportAction} isThreadReportParentAction ... />, which passesreportID = ancestorReport.reportID("5409533764521432") down throughActionContentRouter→ChatMessageContent(AttachmentContext.Provider value={{reportID, type: CONST.ATTACHMENT_TYPE.REPORT}}) →VideoRenderer→VideoPlayerPreview(src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx:44-47).VideoPlayerPreviewinstance inside the thread view hasreportID = "5409533764521432"(the parent report ID where the attachment belongs).Why
prevPlaybackKeyinVideoPlayerPreviewignores the Play click in the thread:VideoPlayerPreviewinsrc/components/VideoPlayerPreview/index.tsx:112-131(introduced whenuseEffectwas converted to a render-phaseplaybackKeycomparison in PR#83382):5409533764521432) and changes its playback speed to 2x,PlaybackContextsets:currentlyPlayingURL = videoUrlcurrentRouteReportID = "5409533764521432"487551176124257):PlaybackContext(src/components/VideoPlayerContexts/PlaybackContext/index.tsx:111-134),getCurrentRouteReportID(currentlyPlayingURL)sees that the focused route (487551176124257) is a chat thread (isChatThread(report) === true), callsfindURLInReportOrAncestorAttachments(report, url), finds the video in the parent report's actions, and returns"5409533764521432"(andisURLStillMountedis alsotruebecause the parent screen stays mounted in the stack). ThusPlaybackContextdoes not reset, leavingcurrentlyPlayingURL === videoUrlandcurrentRouteReportID === "5409533764521432".VideoPlayerPreviewfor the parent action,isThumbnailinitializes touseState(true), andprevPlaybackKeyinitializes touseState(playbackKey)whereplaybackKeyis already:"${videoUrl}|5409533764521432|${videoUrl}|5409533764521432|false".prevPlaybackKey === playbackKeyon initial mount, theif (prevPlaybackKey !== playbackKey)block does not run on mount.00:08–00:13),handleOnPresscallsupdateCurrentURLAndReportID(videoUrl, report, "5409533764521432"). That setscurrentlyPlayingURLto the exact samevideoUrlandcurrentRouteReportIDto the exact same"5409533764521432".currentlyPlayingURLnorcurrentRouteReportIDchanges (playbackKeyis unchanged!), andhandleOnPressnever callssetIsThumbnail(false)directly on wide screens (!isSmallScreenWidth). As a result,isThumbnailstaystrueforever andBaseVideoPlayernever mounts!What changes do you think we should make in order to solve the problem?
In
src/components/VideoPlayerPreview/index.tsx:handleOnPress, when on a wide layout (!isSmallScreenWidth), directly setsetIsThumbnail(false)so pressing the thumbnail Play button always transitions the clickedVideoPlayerPreviewfrom thumbnail toVideoPlayereven whencurrentlyPlayingURLandcurrentRouteReportIDinPlaybackContextalready match thisvideoUrlandreportID(such as when opening a thread after playing the parent video, or returning to a blurred screen wherenavigation.addListener('blur')resetisThumbnailtotruewhileplaybackKeyremained unchanged):tests/unit/VideoPlayerPreviewTest.tsxverifying that whenPlaybackContextalready holds matchingcurrentlyPlayingURL === videoUrlandcurrentRouteReportID === reportIDat the timeVideoPlayerPreviewmounts (or after a navigationblurevent resetsisThumbnailtotrue), pressing the thumbnail on a wide screen (isSmallScreenWidth = false) transitionsisThumbnailtofalseand rendersVideoPlayer.What alternative solutions did you explore? (Optional)
prevPlaybackKeytonull(useState<string | null>(null)) so theif (prevPlaybackKey !== playbackKey)block also runs on mount: IfprevPlaybackKeystarted asnull, mounting the thread screen while the parent video was playing (or paused as the last active video) would immediately auto-replace the thumbnail and auto-play the video inside the thread header as soon as the user clicked "Reply in thread", even if the user only wanted to type a reply. SettingsetIsThumbnail(false)insidehandleOnPress(when!isSmallScreenWidth) keeps the thread header as a clean thumbnail on thread open and reliably mounts and playsVideoPlayer(inheriting the 2xcurrentPlaybackSpeedviaVideoPopoverMenuContext.tsx:45-53) the moment the user clicks Play.— submitted with Antigravity on the contributor's behalf
melvin-bot commentedon Nov 11, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
tranvanminhnhat commentedon Nov 11, 2026
Contributor details
Your Expensify account email: tranvanminhnhat99@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01867c2936746cf5ca
Proposal
Please re-state the problem that we are trying to solve in this issue.
In a thread chat on desktop/web, clicking on an attached video thumbnail fails to mount and play the video player inline.
What is the root cause of that problem?
When clicking on a video thumbnail in a thread,
handleOnPressinVideoPlayerPreview/index.tsxtriggersupdateCurrentURLAndReportIDinPlaybackContext/index.tsx.In
PlaybackContext/index.tsx:58-65, when the active report is a thread (isChatThread(report)is true), it normalizes the report ID by looking up ancestor attachments:Consequently,
currentRouteReportIDis set to the parent report's ID.However, the
VideoPlayerPreviewmounted inside the thread receivesreportIDas the thread's ownreportID.In
VideoPlayerPreview/index.tsx:128-130:Because
reportID(thread report ID) does not matchcurrentRouteReportID(parent report ID), the condition evaluates tofalse. Therefore,setIsThumbnail(false)is never called, and the preview remains permanently stuck in thumbnail mode without mounting the video player.What changes do you think we should make in order to solve the problem?
In
src/components/VideoPlayerPreview/index.tsx:When verifying whether the active video matches the preview:
Check if
reportID === currentRouteReportIDOR ifreportis a chat thread whose parent/ancestor report matchescurrentRouteReportID(e.g.report?.parentReportID === currentRouteReportIDorfindURLInReportOrAncestorAttachments(report, videoUrl) === currentRouteReportID).Alternatively, in
VideoPlayerPreview/index.tsx, when invokinghandleOnPress:Pass the normalized report ID corresponding to the ancestor attachment context so that
reportIDpassed toVideoPlayerPreviewandcurrentRouteReportIDinPlaybackContextstay consistent.What alternative solutions did you explore? (Optional)
Bypassing the
reportID === currentRouteReportIDcheck entirely: Not recommended because multiple chats or search results may display the same video attachment, and we only want the focused instance to switch from thumbnail to active player.What automated tests can you add to prevent this from re-occurring?
In
tests/unit/VideoPlayerPreviewTest.tsx:Add a test verifying that when a video attachment is rendered inside a thread report context, triggering playback successfully switches
isThumbnailtofalseand mounts the player.melvin-bot commentedon Nov 11, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
kevinjosh10 commentedon Nov 12, 2026
Proposal
What is the root cause of that problem?
There are two distinct root causes that combine to completely block video playback inside thread chats on desktop/web:
reportIDmismatch between thread and normalized ancestor report inPlaybackContext:PlaybackContext/index.tsx:58-65, whenupdateCurrentURLAndReportIDis called with a thread report (isChatThread(report)istrue),setCurrentRouteReportIDdoes not set the thread's own report ID. Instead, it resolves the ancestor report ID where the attachment originated viafindURLInReportOrAncestorAttachments(report, url):currentRouteReportIDinPlaybackContextis set toparentReport.reportID.VideoPlayerPreview/index.tsx:128-130, the component receivesreportIDas the thread's report ID (threadReport.reportID). It checks:reportID(threadReport.reportID) does not equalcurrentRouteReportID(parentReport.reportID), this check evaluates tofalse.setIsThumbnail(false)is never called, leaving the video permanently trapped in thumbnail mode.handleOnPressfails to transitionisThumbnailand staleplaybackKeystate prevents re-evaluation:VideoPlayerPreview/index.tsx:112-117:!isSmallScreenWidth), clicking the thumbnail's play button is an explicit user intent to mount and play the video inline. However,handleOnPressdoes not callsetIsThumbnail(false)directly; it delegates thumbnail toggling solely to theprevPlaybackKey !== playbackKeyrender check (VideoPlayerPreview/index.tsx:123-131).currentlyPlayingURLis alreadyvideoUrl, andcurrentRouteReportIDis alreadyparentReport.reportID.updateCurrentURLAndReportID(videoUrl, report, reportID)setscurrentlyPlayingURLandcurrentRouteReportIDto the exact same values they already held. Consequently,playbackKeydoes not change (prevPlaybackKey !== playbackKeyevaluates tofalse), so the thumbnail state transition is never even triggered.What changes do you think we should make in order to solve the problem?
1. In
src/components/VideoPlayerPreview/index.tsx:Directly set
setIsThumbnail(false)inhandleOnPresson wide screens (!isSmallScreenWidth), and update the playback matching condition to support thread reports whose ancestor attachment matchescurrentRouteReportID:What alternative solutions did you explore? (Optional)
setIsThumbnail(false)inhandleOnPresswithout updating theplaybackKeycheck:While setting
setIsThumbnail(false)directly inhandleOnPressresolves the immediate user click, if playback is triggered externally or when navigating between related chats, the thumbnail would fail to activate becausereportID === currentRouteReportIDremains false for thread reports. Doing both ensures airtight reliability.currentRouteReportIDinsideVideoPlayerPreviewprops:Passing the ancestor report ID into
VideoPlayerPreviewwould break downstream components likeVideoPlayer(src/components/VideoPlayer/index.tsx) anduseReportActionswhich require the realreportIDof the current screen to load comments and thread actions. ResolvingisMatchingReportwithinVideoPlayerPreviewpreserves the integrity ofreportID.What automated tests can you add to prevent this from re-occurring?
In
tests/unit/VideoPlayerPreviewTest.tsx:isSmallScreenWidth: false) setsisThumbnailtofalseand rendersVideoPlayer.VideoPlayerPreviewis rendered inside a chat thread report (isChatThread(report) === true) andcurrentRouteReportIDinPlaybackContextmatches the parent report ID where the video originated,isMatchingReportresolves totrueand activates the player.Contributor details
Your Expensify account email: lkevinjosh10@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
melvin-bot commentedon Nov 12, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
cocvn157 commentedon Nov 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web desktop (
!isSmallScreenWidth), after sending and playing a video inline in a chat (and changing playback speed to2x), clicking Reply in thread to open the thread and then clicking the Play button on the parent video thumbnail in the thread header does nothing—the attachment stays stuck as a thumbnail instead of mounting the inline video player and playing at2x.What is the root cause of that problem?
Parent video in a thread header shares the parent
reportID, whileScreenFreezeWrapperon Web freezes the parent screen beforeBaseVideoPlayercan unmount and clearPlaybackContext:ReportActionItemParentAction(src/pages/inbox/report/ReportActionItemParentAction.tsx:61,123-126) resolves ancestors viauseAncestorsand renders<AncestorReportActionItem report={ancestorReport} ... />(src/pages/inbox/report/AncestorReportActionItem.tsx:171-186), which passesreportID = ancestorReport.reportID(the parent chat'sreportID, not the thread'sreportID) down throughReportActionItem->ActionContentRouter->ChatMessageContent(AttachmentContext.Provideratsrc/pages/inbox/report/actionContents/ChatMessageContent.tsx:67,86) ->VideoRenderer->VideoPlayerPreview(src/components/HTMLEngineProvider/HTMLRenderers/VideoRenderer.tsx:44-47).2xspeed) in the parent chat,PlaybackContextstorescurrentlyPlayingURL = videoUrlandcurrentRouteReportID = parentReportID.ReportsSplitNavigator(src/libs/Navigation/AppNavigator/createSplitNavigator/index.tsx:26) pushes the threadReportScreenwithnonTopScreenBehavior: 'freeze'.ScreenFreezeWrapper(src/libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent/ScreenFreezeWrapper/index.native.tsx:13,30-35) delayssetFrozen(true)byFREEZE_DELAY_MS = 500ms +requestAnimationFrameso transitional UI updates flush first;VideoPlayerPreview'sblurlistener (setIsThumbnail(true)) commits, unmounting the parentBaseVideoPlayerand running its cleanup (setCurrentlyPlayingURL(null)atsrc/components/VideoPlayer/BaseVideoPlayer.tsx:428-440).ScreenFreezeWrapper(src/libs/Navigation/PlatformStackNavigation/createPlatformStackNavigatorComponent/ScreenFreezeWrapper/index.tsx:108-131) setsfrozen = trueinuseLayoutEffect, suspending the covered parentReportScreeninside<Freeze freeze={true}>before React Navigation'sbluruseEffectlistener (src/components/VideoPlayerPreview/index.tsx:119-121) can commitsetIsThumbnail(true). Consequently, the parentBaseVideoPlayerremains mounted in the frozen tree and never clearscurrentlyPlayingURL(andPlaybackContext's route effect atsrc/components/VideoPlayerContexts/PlaybackContext/index.tsx:107-134also preserves state becausegetCurrentRouteReportIDresolves the thread's ancestor attachment back toparentReportIDandmountedVideoPlayersRefstill containsvideoUrl). The same state retention occurs on wide layouts when a thread opens in RHP while the parent screen remains visible.VideoPlayerPreviewinitializesprevPlaybackKeyto the already-activeplaybackKeyandhandleOnPressnever transitionsisThumbnailwhenPlaybackContextstate is unchanged:src/components/VideoPlayerPreview/index.tsx:62,112-131:VideoPlayerPreviewmounts,currentlyPlayingURLis alreadyvideoUrlandcurrentRouteReportIDis alreadyparentReportID, soprevPlaybackKeyinitializes to the exact activeplaybackKeywhileisThumbnailinitializes totrue.updateCurrentURLAndReportID(videoUrl, report, parentReportID), which writes the exact samecurrentlyPlayingURLandcurrentRouteReportID. BothuseStatesetters bail out (Object.is),playbackKeynever changes (prevPlaybackKey !== playbackKeystaysfalse), andhandleOnPressdoes not callsetIsThumbnail(false)when!isSmallScreenWidth.Hidden-player audio leak when the parent screen freezes mid-playback:
ScreenFreezeWrappersuspends the parentReportScreenon Web beforesetIsThumbnail(true)can unmount the parentBaseVideoPlayer, if the parent video is still playing when the user opens the thread,VideoPlayerPreview'sblurlistener (line 120) never pauses it,updateCurrentURLAndReportID(src/components/VideoPlayerContexts/PlaybackContext/index.tsx:46-48) skipsvideo.pause()becauseurl === currentlyPlayingURLRef.current, andupdateCurrentVideoPlayerRefs(src/components/VideoPlayerContexts/PlaybackContext/usePlaybackContextVideoRefs.ts:38-41) overwritescurrentVideoPlayerRef.currentwith the thread player's ref without pausing the previous player instance—leaving the frozen parent<video>playing simultaneously in the background.What changes do you think we should make in order to solve the problem?
Transition
isThumbnailon wide-screen press and pause active playback on routeblurinsrc/components/VideoPlayerPreview/index.tsx:pauseVideofromusePlaybackActionsContext().handleOnPress, explicitly callsetIsThumbnail(false)when!isSmallScreenWidthso clicking the thumbnail Play button always mountsVideoPlayereven whencurrentlyPlayingURLandcurrentRouteReportIDalready matchvideoUrlandreportID(once mounted,BaseVideoPlayerregisters viashareVideoPlayerElements, updatingoriginalParentandcurrentVideoPlayerRef, which triggersVideoPopoverMenuContext.tsx:45-53to apply the stored2xcurrentPlaybackSpeed):navigation.addListener('blur', ...)effect, imperatively pause viapauseVideo()when this preview owns the active inline player and we are not opening the attachment modal (!isOnAttachmentRoute()), ensuring aScreenFreezeWrapper-suspended parent<video>stops immediately even though its React state re-render is frozen until unfreeze:Pause any previous distinct
VideoPlayerinstance before swapping refs insrc/components/VideoPlayerContexts/PlaybackContext/usePlaybackContextVideoRefs.ts:updateCurrentVideoPlayerRefs(lines 38-41), ifcurrentVideoPlayerRef.current && currentVideoPlayerRef.current !== playerRef, pause the outgoing player before overwritingcurrentVideoPlayerRef.current:BaseVideoPlayerinstances for the same URL (such as a frozen parent screen + thread screen, or central pane + RHP) can never play simultaneously.Add unit tests in a new
tests/unit/VideoPlayerPreviewTest.tsxfile:VideoPlayerPreviewmounts on a wide screen (isSmallScreenWidth = false) whilePlaybackContextalready holdscurrentlyPlayingURL === videoUrlandcurrentRouteReportID === reportID, pressing the thumbnail transitionsisThumbnailtofalseand rendersVideoPlayer.blurevent (when not onROUTES.REPORT_ATTACHMENTS) callspauseVideo()when the preview is the active inline player and resetsisThumbnailtotrue.updateCurrentVideoPlayerRefspauses a previously registered distinctVideoPlayerinstance when registering a new instance for the same video URL.What alternative solutions did you explore? (Optional)
prevPlaybackKeytonullso the render-phaseprevPlaybackKey !== playbackKeycheck runs on initial mount: Rejected because opening a thread (or scrolling a second occurrence into view) whilecurrentlyPlayingURL === videoUrlwould immediately replace the thumbnail and auto-play the video in the thread header without the user clicking Play, even when the user only opened the thread to type a reply.isChatThread(report) && findURLInReportOrAncestorAttachments(...)insideVideoPlayerPreview: Unnecessary and ineffective here becauseAncestorReportActionItemalready passesparentReport.reportID(isChatThread(report) === false) toVideoPlayerPreview, and for a video posted directly inside a thread (or nested thread),findURLInReportOrAncestorAttachmentsalready returns that thread's ownreportIDmatchingreportID.FitseTLT commentedon Nov 17, 2026
REviewing this week
expensify-chore-bot commentedon Nov 20, 2026
@FitseTLT Whoops! This issue is 2 days overdue. Let's get this updated quick!
FitseTLT commentedon Nov 20, 2026
Not overdue