Skip to content

Bug: Empty space shown for Model field when saved provider no longer exists #551

Description

@hbhalodia

Description

In the Developer Settings panel, when a provider and model have been previously selected and saved, removing that provider leaves an empty space where the Model field used to be - even though the Model field itself is not rendered.

Expected Behavior

The Model field and its container should be fully hidden when the saved provider no longer exists. No empty space should appear between the Provider dropdown and the Reset to default link.

Actual Behavior

The Model field's container is still rendered (taking up vertical space) because isVisible only checks !! data.provider, which is true for any non-empty saved provider ID - even if that provider no longer exists in the available providers list.

Fix

Update the isVisible callback for the model field to also verify the saved provider ID exists in the current providers array:

- isVisible: ( data: DeveloperSelection ) => !! data.provider,
+ isVisible: ( data: DeveloperSelection ) =>
+     !! data.provider &&
+     !! providers.find( ( p ) => p.id === data.provider ),

Step-by-step reproduction instructions

  1. Open Developer Settings for any feature.
  2. Select a provider from the Provider dropdown.
  3. Select a model from the Model dropdown.
  4. Remove the selected provider (e.g., deactivate/delete the provider integration).
  5. Return to Developer Settings for the same feature.

Screenshots, screen recording, code snippet

Screen.Recording.2026-05-14.at.12.24.04.PM.mov
Image

Environment info

  • WordPress - 7.0-RC3-62350
  • AI plugin - Develop branch

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except the AI plugin.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Labels

[Type] BugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions