Skip to content

Fix SeoPanel pending draft flush#1109

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

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

Conversation

@richardjoo
Copy link
Copy Markdown
Contributor

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: fc54692

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 23, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1109

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1109

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1109

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1109

emdash

npm i https://pkg.pr.new/emdash@1109

create-emdash

npm i https://pkg.pr.new/create-emdash@1109

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1109

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1109

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1109

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1109

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1109

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1109

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1109

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1109

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1109

commit: fc54692

@richardjoo
Copy link
Copy Markdown
Contributor Author

I checked the red CI item on this PR.
It isn't one of the test suites, and it doesn't appear to be caused by the SeoPanel change.

What's failing is the Query Counts workflow (Measure job), specifically the Regenerate snapshots step.

All of the actual test/quality jobs are green on this PR: Tests, Browser Tests, Integration Tests, E2E, Lint, Typecheck, and Format.

I also reproduced the harness separately, and the failure is in the perf/query-count path, not the admin test path.
On my side, the sqlite query-count run completed, while the d1 query-count run died in the fresh-isolate loop with TypeError: fetch failed.

This branch is also behind the current main, so my guess is that this is a stale-branch / query-count harness issue rather than something introduced by the SeoPanel fix itself. I can rebase/sync and rerun if you want, but I don't think this red check indicates a regression in the code changed here.

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.

3 participants