Skip to content

fix(settings): show the server's message when a request fails - #388

Open
justlevine wants to merge 1 commit into
mainfrom
chore/settings-errors
Open

justlevine wants to merge 1 commit into
mainfrom
chore/settings-errors

Conversation

@justlevine

@justlevine justlevine commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What

When a request on the settings or search screens fails, the admin now sees the error message the server (or apiFetch) sent back. The old fixed copy is still used when the error has no message.

Why

Related Issue(s):

How

  • Each of those catches now uses ( error as { message?: string } )?.message || with the old copy as the fallback, the same inline pattern page.tsx, AlgoliaSettings.tsx and SiteIndexableEntities.tsx already use.
  • SiteTypeSettings just awaits the save and reloads, without the response check.
  • Tests now reject with a server-shaped { code, message, data: { status } } and assert that message, and a few keep a {} rejection to cover the fallback copy.

AI Disclosure

Opus 5.5 identified the mismatch and backported the initial version and draft PR description.

Testing Instructions

Screenshots

Additional Info

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • I have added necessary tests to cover my changes.
  • I have updated the project documentation as needed.
  • My code has detailed inline documentation.
  • My code is tested to the best of my abilities.
  • My code passes all lints, tests, and checks.
Open WordPress Playground Preview

@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.87%. Comparing base (2b01585) to head (49ac4ca).

Files with missing lines Patch % Lines
assets/src/components/SiteSearchSettings.tsx 33.33% 1 Missing and 1 partial ⚠️
assets/src/admin/settings/page.tsx 0.00% 0 Missing and 1 partial ⚠️
assets/src/components/SiteSettings.tsx 66.66% 0 Missing and 1 partial ⚠️
assets/src/components/SiteTypeSettings.tsx 66.66% 0 Missing and 1 partial ⚠️
assets/src/components/deactivation-settings.tsx 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #388      +/-   ##
============================================
- Coverage     90.82%   85.87%   -4.96%     
============================================
  Files            51       14      -37     
  Lines          3336      630    -2706     
  Branches        181      189       +8     
============================================
- Hits           3030      541    -2489     
+ Misses          255       34     -221     
- Partials         51       55       +4     
Flag Coverage Δ
unit ?
vitest 85.87% <45.45%> (-0.49%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
assets/src/admin/settings/page.tsx 80.30% <0.00%> (-1.24%) ⬇️
assets/src/components/SiteSettings.tsx 93.87% <66.66%> (-1.78%) ⬇️
assets/src/components/SiteTypeSettings.tsx 90.90% <66.66%> (+3.95%) ⬆️
assets/src/components/deactivation-settings.tsx 93.75% <0.00%> (-6.25%) ⬇️
assets/src/components/SiteSearchSettings.tsx 84.56% <33.33%> (-0.97%) ⬇️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@justlevine
justlevine force-pushed the chore/settings-errors branch from 18813c3 to 49ac4ca Compare November 17, 2026 20:57
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