setDefaultForm function infrastructure exported ✓ 100.0%

Last updated: 2026-03-01T23:25:47.133Z

Metrics

LOC: 11 Complexity: 2 Params: 1 Coverage: 100.0% (2/2 lines, 1x executed)

Signature

setDefaultForm(formId: string): : Promise<void>

Summary

Sets one form as the default, clearing isDefault from all others.

Tags

#@param formId - The form to mark as default

Source Code

export async function setDefaultForm(formId: string): Promise<void> {
  await updateStorageAtomically(
    STORAGE_KEYS.SAVED_FORMS,
    [] as SavedForm[],
    (forms) =>
      forms.map((f) => ({
        ...f,
        isDefault: f.id === formId ? true : undefined,
      })),
  );
}

Dependencies (Outgoing)

graph LR setDefaultForm["setDefaultForm"] updateStorageAtomically["updateStorageAtomically"] setDefaultForm -->|calls| updateStorageAtomically style setDefaultForm fill:#dbeafe,stroke:#2563eb,stroke-width:2px click setDefaultForm "a474b5e75cb3500a.html" click updateStorageAtomically "bf2f57323401fa98.html"
TargetType
updateStorageAtomically calls

Impact (Incoming)

graph LR setDefaultForm["setDefaultForm"] handle["handle"] handle -->|uses| setDefaultForm style setDefaultForm fill:#dbeafe,stroke:#2563eb,stroke-width:2px click setDefaultForm "a474b5e75cb3500a.html" click handle "02de534415e566f4.html"
SourceType
handle uses