Skip to content

Save Snippet Button Not Working / Loading State Not Updating #21

@chiscookeke11

Description

@chiscookeke11

Description

When clicking the "Save Snippet" or "Update Snippet" button in the Snippets page, nothing happens. The form does not submit properly, and the loading state (loading) does not show while the API request is in progress. This makes it unclear to the user whether the action was successful or if something went wrong.

Expected Behavior

  • Clicking Save Snippet should submit the form and save the snippet via the API.
  • While saving, a loading indicator should appear to indicate that the request is in progress.
  • After a successful save:
    • The form should close
    • The snippet list should refresh to include the new/updated snippet
  • Errors should be displayed if the API request fails.

Current Behavior

  • Clicking the button sometimes does nothing
  • No loading feedback is shown
  • The snippet list may not refresh correctly
  • The form does not always close on successful submission

Suggested Fix

  • Ensure the onSubmit function is properly awaited and errors are caught.
  • Update loading state or add a separate saving state to show a loading spinner or disable the submit button while the request is in progress.
  • After successful save, call fetchSnippets() to refresh the list and closeForm() to reset the form.
  • Consider disabling the submit button during the save to prevent multiple submissions.

Acceptance Criteria

  • Clicking Save Snippet / Update Snippet triggers the API request.
  • A loading state (spinner or disabled button) is visible while saving.
  • Snippet list refreshes automatically after saving.
  • Form closes after successful save.
  • Errors are handled and displayed to the user if saving fails.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions