Skip to content

fix: warn when Partial with append/prepend mode is missing key prop#3738

Merged
bartlomieju merged 2 commits into
mainfrom
fix/warn-partial-missing-key
Mar 29, 2026
Merged

fix: warn when Partial with append/prepend mode is missing key prop#3738
bartlomieju merged 2 commits into
mainfrom
fix/warn-partial-missing-key

Conversation

@bartlomieju
Copy link
Copy Markdown
Contributor

Summary

  • Adds a console.warn during SSR when a <Partial> uses mode="append" or mode="prepend" without a key prop
  • Without a key, Preact cannot correctly reconcile prepended/appended children, leading to subtle rendering bugs
  • No warning for mode="replace" (default) since keys aren't required there

Test plan

  • Warns for mode="append" without key
  • Warns for mode="prepend" without key
  • No warning when key is provided
  • No warning for replace mode or default mode without key

🤖 Generated with Claude Code

bartlomieju and others added 2 commits March 29, 2026 19:59
Without a key, Preact cannot correctly reconcile prepended/appended
children, leading to subtle rendering bugs. This adds a console.warn
during server-side rendering so developers get immediate feedback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update examples to include key props and upgrade the info box to a
warning explaining why keys are required and that Fresh now warns
when they're missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju merged commit be467d3 into main Mar 29, 2026
9 checks passed
@bartlomieju bartlomieju deleted the fix/warn-partial-missing-key branch March 29, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant