22 lines
976 B
TypeScript
22 lines
976 B
TypeScript
import type { CreateFlowState } from "../types";
|
|
import { forgetFlushedCommunityAvatarUrl } from "../../../../lib/create/flushPendingCommunityAvatar";
|
|
import { clearPendingCommunityAvatarFile } from "../../../../lib/create/pendingCommunityAvatarUpload";
|
|
import {
|
|
clearTransferPendingFlag,
|
|
writeAnonymousCreateFlowState,
|
|
} from "./anonymousDraftStorage";
|
|
import { writeCoreValueDetailsToLocalStorage } from "./coreValueDetailsLocalStorage";
|
|
|
|
/**
|
|
* Profile already has the server draft. Write that snapshot into the browser
|
|
* before opening the wizard so the create flow can mount it immediately,
|
|
* including when backend sync is off and hydration will not refetch.
|
|
*/
|
|
export function seedContinuedDraftLocalStorage(state: CreateFlowState): void {
|
|
writeAnonymousCreateFlowState(state);
|
|
writeCoreValueDetailsToLocalStorage(state.coreValueDetailsByChipId);
|
|
clearTransferPendingFlag();
|
|
forgetFlushedCommunityAvatarUrl();
|
|
void clearPendingCommunityAvatarFile();
|
|
}
|