close
Skip to content

Fix: Bug: Missing No-Provider UX Handling for Standalone Media Image Generation#575

Merged
dkotter merged 2 commits into
WordPress:developfrom
hbhalodia:fix/issue-572
May 19, 2026
Merged

Fix: Bug: Missing No-Provider UX Handling for Standalone Media Image Generation#575
dkotter merged 2 commits into
WordPress:developfrom
hbhalodia:fix/issue-572

Conversation

@hbhalodia
Copy link
Copy Markdown
Contributor

@hbhalodia hbhalodia commented May 19, 2026

What?

Closes #572

Why?

  • Fixes the AI provider availability notice not being displayed on the standalone image generation admin page (Media Library context).
  • The generate() function in useImageGeneration calls ensureProvider(), which dispatches a notice via the @wordpress/notices store. In the block editor, this store has a built-in renderer that displays the notice in the editor UI. However, on the standalone admin page there is no renderer for that store, so the notice is dispatched but never shown -the user sees no feedback when a provider is missing.

How?

  • Added a safeGenerate() wrapper in GenerateImageStandalone that checks isProviderAvailable() before calling generate(). If no provider is configured, it sets the component-level error state, which renders an inline <Notice> component from @wordpress/components directly in the UI.
  • Keeps the shared useImageGeneration hook unchanged (no double-notice in block editor)
  • Uses the same pattern as the alt-text generation feature (media.ts), which also checks isProviderAvailable() directly for non-editor contexts

Use of AI Tools

AI assistance: Yes
Tool(s): GitHub Copilot, Claude
Model(s): Claude Opus 4.6
Used for: Used for generating PR description and potential solution based on past PR and changes. Changes reviewed by me.

Testing Instructions

  1. Remove any connector/provider.
  2. Open the page - /wp-admin/upload.php?page=generate-image
  3. Generate Image.
  4. You will have notice to connect the provider.

Screenshots or screencast

Screen.Recording.2026-05-19.at.1.45.24.PM.mov

Changelog Entry

Fixed - Add notice to standalone Image generation when there is no provider connected.

Open WordPress Playground Preview

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.41%. Comparing base (396fcc3) to head (9bd5122).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #575      +/-   ##
=============================================
- Coverage      71.41%   71.41%   -0.01%     
  Complexity      1158     1158              
=============================================
  Files             67       67              
  Lines           5584     5586       +2     
=============================================
+ Hits            3988     3989       +1     
- Misses          1596     1597       +1     
Flag Coverage Δ
unit 71.41% <ø> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@dkotter dkotter added this to the 1.0.0 milestone May 19, 2026
@dkotter dkotter mentioned this pull request May 19, 2026
42 tasks
@dkotter dkotter merged commit 3f8dfd7 into WordPress:develop May 19, 2026
17 of 18 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.

Bug: Missing No-Provider UX Handling for Standalone Media Image Generation

2 participants