From 55a858783c541a1275d698a53c6de8d5b57c0193 Mon Sep 17 00:00:00 2001 From: 0x464e <36742501+0x464e@users.noreply.github.com> Date: Fri, 20 Mar 2026 21:54:07 +0200 Subject: [PATCH] Bugfix: Share dialog was not receiving the player timestamp after removing key that triggered remounts --- .../overlay/ShareTimestampDialog.tsx | 31 +++++++------------ web/src/views/recording/RecordingView.tsx | 16 +++++++++- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/web/src/components/overlay/ShareTimestampDialog.tsx b/web/src/components/overlay/ShareTimestampDialog.tsx index 846d84377..df761d539 100644 --- a/web/src/components/overlay/ShareTimestampDialog.tsx +++ b/web/src/components/overlay/ShareTimestampDialog.tsx @@ -31,6 +31,10 @@ type ShareTimestampDialogProps = { currentTime: number; open: boolean; onOpenChange: (open: boolean) => void; + selectedOption: "current" | "custom"; + setSelectedOption: (option: "current" | "custom") => void; + customTimestamp: number; + setCustomTimestamp: (timestamp: number) => void; onShareTimestamp: (timestamp: number) => void; }; @@ -38,35 +42,22 @@ export default function ShareTimestampDialog({ currentTime, open, onOpenChange, + selectedOption, + setSelectedOption, + customTimestamp, + setCustomTimestamp, onShareTimestamp, }: Readonly) { const { t } = useTranslation(["components/dialog"]); - const [selectedOption, setSelectedOption] = useState<"current" | "custom">( - "current", - ); - const [openedCurrentTime, setOpenedCurrentTime] = useState( - Math.floor(currentTime), - ); - const [customTimestamp, setCustomTimestamp] = useState(openedCurrentTime); const handleOpenChange = useCallback( - (nextOpen: boolean) => { - if (nextOpen) { - const initialTimestamp = Math.floor(currentTime); - - setOpenedCurrentTime(initialTimestamp); - setSelectedOption("current"); - setCustomTimestamp(initialTimestamp); - } - - onOpenChange(nextOpen); - }, - [currentTime, onOpenChange], + (nextOpen: boolean) => onOpenChange(nextOpen), + [onOpenChange], ); const content = ( ("current"); + const [customShareTimestamp, setCustomShareTimestamp] = useState( + Math.floor(startTime), + ); // move to next clip @@ -694,13 +700,21 @@ export function RecordingView({ currentTime={shareTimestampAtOpen} open={shareTimestampOpen} onOpenChange={setShareTimestampOpen} + selectedOption={shareTimestampOption} + setSelectedOption={setShareTimestampOption} + customTimestamp={customShareTimestamp} + setCustomTimestamp={setCustomShareTimestamp} onShareTimestamp={onShareReviewLink} /> )} {isDesktop && ( { - setShareTimestampAtOpen(Math.floor(currentTime)); + const initialTimestamp = Math.floor(currentTime); + + setShareTimestampAtOpen(initialTimestamp); + setShareTimestampOption("current"); + setCustomShareTimestamp(initialTimestamp); setShareTimestampOpen(true); }} onDebugReplayClick={() => {