Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Preserve cloud share results across session refreshes

webadderall84167806b000
diff --git a/src/components/video-editor/cloud/CloudShareButton.tsx b/src/components/video-editor/cloud/CloudShareButton.tsx
index cfc3fb4c..16d9827f 100644
--- a/src/components/video-editor/cloud/CloudShareButton.tsx
+++ b/src/components/video-editor/cloud/CloudShareButton.tsx
@@ -29,6 +29,7 @@ type Props = {
onOpenChange?: (open: boolean) => void;
hideTrigger?: boolean;
authToken?: string;
+ accountId?: string;
inline?: boolean;
onBusyChange?: (busy: boolean) => void;
onRequestSignIn?: () => void;
@@ -45,6 +46,7 @@ export function CloudShareButton({
onOpenChange,
hideTrigger = false,
authToken,
+ accountId,
inline = false,
onBusyChange,
onRequestSignIn,
@@ -67,9 +69,6 @@ export function CloudShareButton({
useEffect(() => {
setCapacityAvailable(null);
setCheckingCapacity(false);
- setError(undefined);
- setShareUrl(undefined);
- setCopied(false);
if (!authToken || !DEFAULT_CLOUD_ENDPOINT) return;
let active = true;
setCheckingCapacity(true);
@@ -94,6 +93,14 @@ export function CloudShareButton({
const [error, setError] = useState<string>();
const [shareUrl, setShareUrl] = useState<string>();
const [copied, setCopied] = useState(false);
+ const previousAccountId = useRef(accountId);
+ useEffect(() => {
+ if (previousAccountId.current === accountId) return;
+ previousAccountId.current = accountId;
+ setError(undefined);
+ setShareUrl(undefined);
+ setCopied(false);
+ }, [accountId]);
const [notes, setNotes] = useState("");
const preparedFileRef = useRef<string | undefined>(undefined);
const cancelRequestedRef = useRef(false);
diff --git a/src/components/video-editor/cloud/SharedRecordings.tsx b/src/components/video-editor/cloud/SharedRecordings.tsx
index b72ee76d..778d17cc 100644
--- a/src/components/video-editor/cloud/SharedRecordings.tsx
+++ b/src/components/video-editor/cloud/SharedRecordings.tsx
@@ -1,3 +1,4 @@
+import { parseSharedRecordingDate } from "./sharedRecordingDate";
import { FREE_RECORDING_LIMIT } from "./shareCapacity";
import { LibrarySkeleton } from "../dashboard/LibrarySkeleton";
import { ProjectCard } from "../dashboard/ProjectCard";
@@ -94,13 +95,7 @@ export function SharedRecordings({
.map((recording) => ({
path: recording.code,
name: recording.title,
- updatedAt: recording.createdAt
- ? Date.parse(
- recording.createdAt.includes("T")
- ? recording.createdAt
- : recording.createdAt.replace(" ", "T") + "Z",
- )
- : 0,
+ updatedAt: parseSharedRecordingDate(recording.createdAt),
thumbnailPath: recording.ready
? new URL(`/thumb/${recording.code}`, endpoint).href
: null,
diff --git a/src/components/video-editor/cloud/sharedRecordingDate.test.ts b/src/components/video-editor/cloud/sharedRecordingDate.test.ts
new file mode 100644
index 00000000..d8df5cf5
--- /dev/null
+++ b/src/components/video-editor/cloud/sharedRecordingDate.test.ts
@@ -0,0 +1,17 @@
+import { expect, it } from "vitest";
+import { parseSharedRecordingDate } from "./sharedRecordingDate";
+it.each([
+ undefined,
+ "",
+ "not a date",
+])("normalizes missing or invalid dates (%s) to zero", (value) => {
+ expect(parseSharedRecordingDate(value)).toBe(0);
+});
+it("normalizes SQLite UTC dates and ISO dates to the same timestamp", () => {
+ expect(parseSharedRecordingDate("2026-10-03 04:00:00")).toBe(
+ Date.parse("2026-10-03T04:00:00Z"),
+ );
+ expect(parseSharedRecordingDate("2026-10-03T04:00:00Z")).toBe(
+ Date.parse("2026-10-03T04:00:00Z"),
+ );
+});
diff --git a/src/components/video-editor/cloud/sharedRecordingDate.ts b/src/components/video-editor/cloud/sharedRecordingDate.ts
new file mode 100644
index 00000000..814e6301
--- /dev/null
+++ b/src/components/video-editor/cloud/sharedRecordingDate.ts
@@ -0,0 +1,5 @@
+export function parseSharedRecordingDate(value?: string): number {
+ if (!value) return 0;
+ const parsed = Date.parse(value.includes("T") ? value : `${value.replace(" ", "T")}Z`);
+ return Number.isFinite(parsed) ? parsed : 0;
+}
diff --git a/src/components/video-editor/layout/EditorExportMenu.tsx b/src/components/video-editor/layout/EditorExportMenu.tsx
index 39edb7e9..292458db 100644
--- a/src/components/video-editor/layout/EditorExportMenu.tsx
+++ b/src/components/video-editor/layout/EditorExportMenu.tsx
@@ -38,6 +38,7 @@ type Props = {
onRequestShareSignIn: () => void;
shareRequestNonce: number;
authToken?: string;
+ accountId?: string;
};
export function EditorExportMenu(props: Props) {
@@ -246,6 +247,7 @@ export function EditorExportMenu(props: Props) {
onCancelPrepare={handleCancelExport}
preparationProgress={exportProgress?.percentage ?? 0}
authToken={props.authToken}
+ accountId={props.accountId}
onBusyChange={setShareBusy}
onRequestSignIn={() => {
setShowExportDropdown(false);
diff --git a/src/components/video-editor/layout/EditorHeader.tsx b/src/components/video-editor/layout/EditorHeader.tsx
index 4059976f..478c405a 100644
--- a/src/components/video-editor/layout/EditorHeader.tsx
+++ b/src/components/video-editor/layout/EditorHeader.tsx
@@ -58,6 +58,7 @@ type Props = {
onRequestShareSignIn: () => void;
shareRequestNonce: number;
authToken?: string;
+ accountId?: string;
};
export function EditorHeader(props: Props) {
@@ -245,6 +246,7 @@ export function EditorHeader(props: Props) {
onRequestShareSignIn={props.onRequestShareSignIn}
shareRequestNonce={props.shareRequestNonce}
authToken={props.authToken}
+ accountId={props.accountId}
/>
</div>
</header>
diff --git a/src/components/video-editor/layout/EditorShell.tsx b/src/components/video-editor/layout/EditorShell.tsx
index 8a98833b..a5e17404 100644
--- a/src/components/video-editor/layout/EditorShell.tsx
+++ b/src/components/video-editor/layout/EditorShell.tsx
@@ -275,6 +275,7 @@ export function EditorShell(props: Props) {
onRequestShareSignIn={() => requestSignIn("share")}
shareRequestNonce={shareRequestNonce}
authToken={auth.accessToken}
+ accountId={auth.user?.id}
revealExportedFile={dialogActions.revealExportedFile}
exportMessage={exportMessage}
/>
diff --git a/tests/ui/publish-cloud.spec.ts b/tests/ui/publish-cloud.spec.ts
index 1cf7dea3..1bfe1a16 100644
--- a/tests/ui/publish-cloud.spec.ts
+++ b/tests/ui/publish-cloud.spec.ts
@@ -1,7 +1,7 @@
import { expect, test } from "@playwright/test";
test("publish preserves local destination and stays open throughout sharing", async ({ page }) => {
- await page.goto("/tests/ui/publish.html");
+ await page.goto("/tests/ui/publish.html?switch");
await page.getByRole("button", { name: "Publish", exact: true }).click();
await page.getByRole("row", { name: "Local", exact: true }).click();
await expect(page.getByRole("button", { name: "Export Video", exact: true })).toBeVisible();
@@ -23,6 +23,14 @@ test("publish preserves local destination and stays open throughout sharing", as
await expect(page.getByRole("button", { name: "Copy link", exact: true })).toBeVisible({
timeout: 20000,
});
+ await page
+ .getByRole("button", { name: "Fixture refresh token", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toBeVisible();
+ await page
+ .getByRole("button", { name: "Fixture switch account", exact: true })
+ .evaluate((button: HTMLButtonElement) => button.click());
+ await expect(page.getByRole("button", { name: "Copy link", exact: true })).toHaveCount(0);
});
test("a full cloud quota prevents starting preparation", async ({ page }) => {
diff --git a/tests/ui/publish.tsx b/tests/ui/publish.tsx
index b11a843d..01e289c4 100644
--- a/tests/ui/publish.tsx
+++ b/tests/ui/publish.tsx
@@ -35,6 +35,7 @@ window.electronAPI = {
function Preview() {
const [open, setOpen] = useState(false);
const [authToken, setAuthToken] = useState<string | undefined>("fixture");
+ const [accountId, setAccountId] = useState<string | undefined>("fixture-account");
const [percentage, setPercentage] = useState(0);
const { t } = useI18n();
const [preferences] = useState(loadEditorPreferences);
@@ -43,6 +44,7 @@ function Preview() {
t,
projectTitle: "Preview",
authToken,
+ accountId,
shareRequestNonce: 0,
exportSettings,
exportSession: {
@@ -70,10 +72,25 @@ function Preview() {
<div className="flex justify-end p-12">
{new URLSearchParams(location.search).has("switch") && (
<div>
- <button type="button" onClick={() => setAuthToken(undefined)}>
+ <button type="button" onClick={() => setAuthToken("refreshed-fixture")}>
+ Fixture refresh token
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ setAuthToken(undefined);
+ setAccountId(undefined);
+ }}
+ >
Fixture sign out
</button>
- <button type="button" onClick={() => setAuthToken("other")}>
+ <button
+ type="button"
+ onClick={() => {
+ setAuthToken("other");
+ setAccountId("other-account");
+ }}
+ >
Fixture switch account
</button>
</div>