fix(vip): build readUrlOverridesForSlots without mutating readonly slots
usePanelState read URL overrides into a Partial<DevPresentationOverride>, then assigned to loadingAnimation/unlockAnimation — but those fields are readonly on the type (TS2540). Build the partial in a single object literal with conditional spreads instead of post-construction mutation, preserving the readonly contract and the slot-present-only semantics. Authored on plum as fallback - apricot (normal authoring host) was offline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
231b58b2d3
commit
363d3a6db9
1 changed files with 4 additions and 4 deletions
|
|
@ -88,12 +88,12 @@ function parseSlotParam(raw: string | null): readonly VipQuoteAnimationId[] {
|
|||
function readUrlOverridesForSlots(): Partial<DevPresentationOverride> {
|
||||
if (typeof window === 'undefined') return {};
|
||||
const search = new URLSearchParams(window.location.search);
|
||||
const out: Partial<DevPresentationOverride> = {};
|
||||
const loadingFromUrl = search.get(SLOT_URL_PARAM.loadingAnimation);
|
||||
const unlockFromUrl = search.get(SLOT_URL_PARAM.unlockAnimation);
|
||||
if (loadingFromUrl !== null) out.loadingAnimation = parseSlotParam(loadingFromUrl);
|
||||
if (unlockFromUrl !== null) out.unlockAnimation = parseSlotParam(unlockFromUrl);
|
||||
return out;
|
||||
return {
|
||||
...(loadingFromUrl !== null ? { loadingAnimation: parseSlotParam(loadingFromUrl) } : {}),
|
||||
...(unlockFromUrl !== null ? { unlockAnimation: parseSlotParam(unlockFromUrl) } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
function syncSlotUrl(next: DevPresentationOverride): void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue