Skip to content

DynamicFormBuilder never clears the draft after a successful submit #1055

Description

@RUKAYAT-CODER

Overview
src/components/forms/DynamicFormBuilder.tsx (lines 157-162) awaits submitMutation.mutate(...) then checks submitMutation.isSuccess synchronously to decide whether to clear the auto-save draft. That mutation flag is React state captured in the current render and is still false on this tick, so clearDraft() never runs and stale drafts persist after submission. Clear the draft from the mutation's onSuccess callback (or from the awaited result) instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendNexjs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions