Fix SeoPanel pending draft flush#1109
Conversation
|
There was a problem hiding this comment.
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.
What does this PR do?
Fixes
SeoPanelso pending debounced SEO text edits are still emitted when the panel unmounts or content switches before the debounce timer fires.Closes #
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
pnpm --filter @emdash-cms/admin testpnpm format:check