plugin-seo: Auto-generate button has no loading state when generateTitle/generateURL is async

Open Beginner friendly
#17,239 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
Half a day
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend

Research direction

Start with packages/plugin-seo/src/fields/MetaTitle/MetaTitleComponent.tsx and packages/plugin-seo/src/fields/MetaDescription/MetaDescriptionComponent.tsx. Read regenerateTitle and regenerateDescription, then trace their Auto-generate button handlers. Done means both buttons are disabled and visibly indicate loading until their async fetch completes.

Written by the indexing model from the issue text.

Description

created-by: Contributor

Describe the Bug

The Auto-generate button in the SEO plugin fields (MetaTitleComponent, MetaDescriptionComponent) does not show any loading state while the async generateTitle / generateDescription function is running.

Both components call the async function with void and never set a loading flag:

MetaTitleComponentpackages/plugin-seo/src/fields/MetaTitle/MetaTitleComponent.tsx

onClick: () => {
  void regenerateTitle() // no loading state
}

MetaDescriptionComponentpackages/plugin-seo/src/fields/MetaDescription/MetaDescriptionComponent.tsx

onClick: () => {
  void regenerateDescription() // no loading state
}

The button stays enabled and shows no spinner while an async fetch to /api/plugin-seo/generate-title (or generate-description) is in progress. When generateTitle/generateDescription performs a DB lookup (e.g. fetching tenant config), the wait can be multiple seconds with zero UI feedback.

Expected Behavior

  • The button should be disabled while the request is in flight
  • A loading indicator (spinner or text change) should be shown
  • Applies to both MetaTitleComponent and MetaDescriptionComponent

Reproduction

No reproduction repo needed — the issue is visible in the source directly.

Both regenerateTitle and regenerateDescription are async (they await a fetch), but the button onClick handlers do not track the pending state.

Payload Version

3.84.1

Environment

  • @payloadcms/plugin-seo v3.84.1
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.