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

+26 -3
View File
@@ -16,6 +16,7 @@ import messages from "../../../messages/en/index";
import Alert from "../../components/modals/Alert";
import { isBackendSyncEnabled } from "../../../lib/create/backendSyncEnabled";
import { flushPendingCommunityAvatar } from "../../../lib/create/flushPendingCommunityAvatar";
function buildPayloadWithStep(
base: CreateFlowState,
@@ -111,8 +112,15 @@ export function PostLoginDraftTransfer({
return;
}
const flushed = await flushPendingCommunityAvatar();
if (cancelled) return;
const transferred =
flushed.status === "uploaded"
? { ...payload, communityAvatarUrl: flushed.url }
: payload;
if (isBackendSyncEnabled() && createFlowStateHasKeys(local)) {
const saveResult = await saveDraftToServer(payload);
const saveResult = await saveDraftToServer(transferred);
if (cancelled) return;
if (saveResult.ok === false) {
@@ -127,8 +135,23 @@ export function PostLoginDraftTransfer({
}
}
clearAnonymousCreateFlowStorage();
replaceState(payload);
clearAnonymousCreateFlowStorage({
preservePendingAvatar: flushed.status === "failed",
});
replaceState((prev) => {
const fromPayload =
typeof transferred.communityAvatarUrl === "string"
? transferred.communityAvatarUrl.trim()
: "";
const fromPrev =
typeof prev.communityAvatarUrl === "string"
? prev.communityAvatarUrl.trim()
: "";
const communityAvatarUrl = fromPayload || fromPrev;
return communityAvatarUrl
? { ...transferred, communityAvatarUrl }
: transferred;
});
if (pathname) {
const params = new URLSearchParams(searchParams.toString());