Skip to content

Adding an annotation loses the draft when the save request fails #44809

Closed

Description

@lyzno1

Self Checks

  • I have searched for existing issues describing this problem.
  • I have read the contribution guidelines.

Environment

Dify frontend on main (c28e136be0), application annotations page.

Steps to reproduce

  1. Open an application's Annotations page and choose Add Annotation.
  2. Enter a question and reply.
  3. Make POST /apps/{app_id}/annotations fail, for example by blocking the request in browser developer tools.
  4. Select Add. Repeat with Add another annotation reply selected.

Actual behavior

The submission handler catches the rejection and then runs the success cleanup anyway: the panel closes, or both fields are cleared when continuous creation is selected. The draft is lost even though the annotation was not saved. Closing remains available during submission.

Expected behavior

Keep the panel and draft available after a failed save, show a recoverable error, and reset or close only after success. Pending submissions should prevent duplicate creation and dismissal. Continuous creation should retain its preference, clear only the saved fields, and focus the question for the next entry.

Proposed scope

Use the existing positioned Dialog primitives for this modal form, retaining its right-side placement and question/reply avatars. Keep submission state with the dialog, use the generated annotation mutation and shared cache invalidation, and cover validation, retries, pending interactions, and continuous creation.

From Codex

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions