Skip to content

Fix SeoPanel pending draft flush#1109

Open
richardjoo wants to merge 1 commit into
emdash-cms:mainfrom
richardjoo:split/seopanel-flush-fix
Open

Fix SeoPanel pending draft flush#1109
richardjoo wants to merge 1 commit into
emdash-cms:mainfrom
richardjoo:split/seopanel-flush-fix

Conversation

@richardjoo
Copy link
Copy Markdown

What does this PR do?

Fixes SeoPanel so pending debounced SEO text edits are still emitted when the panel unmounts or content switches before the debounce timer fires.

Closes #

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: GPT-5.4 / OpenCode

Screenshots / test output

  • pnpm --filter @emdash-cms/admin test
  • pnpm format:check

Copilot AI review requested due to automatic review settings May 19, 2026 19:20
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

⚠️ No Changeset found

Latest commit: 5d680f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes SeoPanel so any pending debounced SEO text edits are flushed (emitted via onChange) when the panel unmounts or when the editor switches to a different contentKey before the debounce timer fires.

Changes:

  • Update flushPendingDraft() to cancel any pending timer and avoid emitting when the current draft matches the last emitted snapshot.
  • Strengthen the unmount-flush test to assert the flushed value is the final emitted call and that no later debounce emits occur.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/admin/src/components/SeoPanel.tsx Ensures pending debounced draft updates are flushed safely on unmount/content switch without redundant emits.
packages/admin/tests/components/SeoPanel.test.tsx Verifies pending debounced edits are flushed on unmount and no additional emits happen after the debounce window.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants