Skip to content

fix(marketplace): surface archive failures#367

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
Zekbot001:money/ugig-marketplace-archive-errors
Jun 4, 2026
Merged

fix(marketplace): surface archive failures#367
ralyodio merged 1 commit into
profullstack:masterfrom
Zekbot001:money/ugig-marketplace-archive-errors

Conversation

@Zekbot001
Copy link
Copy Markdown
Contributor

Summary

  • surface rejected archive requests in skill, MCP, and prompt listing forms
  • preserve the owner page on failure and always restore each Archive button state
  • cover the shared regression with a table-driven component test across all three forms

Paid task

https://ugig.net/gigs/abd6b2a0-e728-48cf-a46f-f99e419ed94e

Verification

  • pnpm exec vitest run src/components/MarketplaceListingArchive.test.tsx
  • pnpm exec eslint src/components/skills/SkillListingForm.tsx src/components/mcp/McpListingForm.tsx src/components/prompts/PromptListingForm.tsx src/components/MarketplaceListingArchive.test.tsx
  • git diff --check

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 31, 2026

Greptile Summary

This PR fixes a silent-failure bug in the Archive action across all three marketplace listing forms (skill, MCP, prompt): previously, non-2xx responses and network errors were swallowed entirely, leaving the button stuck in a loading state and the user with no feedback. The fix surfaces API error messages, clears stale errors before each attempt, and uses a finally block to reliably restore the Archive button regardless of outcome.

  • Error surfacing: !res.ok branches now parse data.error from the response body (falling back to a generic message) and call setError, replacing the // ignore catch blocks.
  • Button restoration: Moving setDeleting(false) into a finally block guarantees it runs even when the !res.ok path uses an early return inside the try.
  • Test coverage: A new it.each test renders all three form components, stubs fetch with a 403, and asserts the error text appears, the button re-enables, and no navigation occurs.

Confidence Score: 5/5

Safe to merge — the change is a targeted, well-tested improvement to error handling that does not affect happy-path data flow.

All three forms receive an identical, mechanically correct fix: the finally block reliably re-enables the button even with an early return in the error path, API error messages are now propagated to the UI, and the new table-driven test validates the key regression across all three form components. No new state, no data model changes, no async sequencing issues introduced.

No files require special attention.

Important Files Changed

Filename Overview
src/components/mcp/McpListingForm.tsx Rewrites handleDelete to surface API errors via setError, clear errors before each attempt, and use a finally block to always restore the Archive button — replacing the previous silent-ignore pattern.
src/components/prompts/PromptListingForm.tsx Identical fix to McpListingForm applied to the prompts archive flow: non-OK responses now set an error message and the finally block guarantees the button is re-enabled.
src/components/skills/SkillListingForm.tsx Same three-form fix applied to skills: error surfacing, error clearing on new attempts, and always-runs finally block restoring the Archive button state.
src/components/MarketplaceListingArchive.test.tsx New table-driven test that verifies all three form components surface the API error message, re-enable the Archive button, and skip navigation on a 403 response.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([User clicks Archive]) --> B{confirm dialog}
    B -- cancelled --> Z([Return, no change])
    B -- confirmed --> C[setDeleting true\nsetError null]
    C --> D[fetch DELETE /api/resource/slug]
    D -- network error --> E[catch: setError fallback message]
    E --> F[finally: setDeleting false]
    F --> G([Error shown, button re-enabled])
    D -- res.ok false --> H[parse res.json\nsetError data.error or fallback]
    H --> I[return]
    I --> F
    D -- res.ok true --> J[router.push dashboard\nrouter.refresh]
    J --> K[finally: setDeleting false]
    K --> L([Navigate away])
Loading

Reviews (1): Last reviewed commit: "fix(marketplace): surface archive failur..." | Re-trigger Greptile

@ralyodio ralyodio merged commit 1c626c3 into profullstack:master Jun 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants