Skip to content

Show clear feedback when snippet activation fails #516

Open

Description

@code-snippets-bot

Problem

When activation fails because a snippet contains invalid code, the activation switch on the snippets table may appear enabled temporarily without explaining that the snippet remains inactive. Opening the snippet afterward shows that it was not activated.

Forum report: https://wordpress.org/support/topic/issue-related-to-the-the-snippet-toggle-button-behavior/

Expected behavior

  • A snippet that fails validation remains visibly inactive.
  • The switch returns immediately to its confirmed state.
  • A clear, actionable notice explains that activation failed and no activation change was made.
  • Activation and deactivation failures provide consistent feedback in both table and card views.
  • Bulk actions report partial failures rather than silently ignoring them.

Related implementation

PR #488 adds user-facing feedback for failed snippet actions on the management screen.

Activity

  1. code-snippets-bot commented on Sep 3, 2026

    @code-snippets-bot
    ContributorAuthor

    Additional report: https://wordpress.org/support/topic/toggles-dont-change-state-after-update-to-3-10-2/

    This exposes a partial-success case that the current issue and PR #488 need to handle. The activation or deactivation request can return HTTP 500 after the database state has already changed. Because the snippets list refresh runs only after a successful response, the controlled switch keeps showing its previous state until the page is reloaded.

    The failure message must not state that nothing changed without reconciling the saved state. On request failure, the UI should refetch the snippet and display the actual state, while still reporting the server error. The endpoint should also avoid returning a failure after committing the state where possible.

  2. mszyplinski commented on Oct 12, 2026

    @mszyplinski

    Are you going to fix it?

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