Keep a guest community logo on review and on the published rule.

Sign-in was clearing the staged file before it uploaded, and review only read the server URL, so a chosen logo disappeared after the upload step.
This commit is contained in:
adilallo committed 2026-11-05 20:02:40 -07:00
1 parent 2348a9e94f
commit 8212423ec3
19 files changed
+780 -61

No files matched your search

@@ -1,4 +1,5 @@
import type { CreateFlowState } from "../types";
import { forgetFlushedCommunityAvatarUrl } from "../../../../lib/create/flushPendingCommunityAvatar";
import { migrateLegacyCreateFlowState } from "../../../../lib/create/migrateLegacyCreateFlowState";
import { clearPendingCommunityAvatarFile } from "../../../../lib/create/pendingCommunityAvatarUpload";
@@ -47,7 +48,10 @@ export function writeAnonymousCreateFlowState(value: CreateFlowState): void {
}
}
export function clearAnonymousCreateFlowStorage(): void {
export function clearAnonymousCreateFlowStorage(options?: {
/** Keep the staged logo so a failed upload can retry. */
preservePendingAvatar?: boolean;
}): void {
if (typeof window === "undefined") return;
try {
window.localStorage.removeItem(CREATE_FLOW_ANONYMOUS_KEY);
@@ -55,6 +59,8 @@ export function clearAnonymousCreateFlowStorage(): void {
} catch {
// ignore
}
if (options?.preservePendingAvatar) return;
forgetFlushedCommunityAvatarUrl();
void clearPendingCommunityAvatarFile();
}