Skip to content

Commit

Permalink
Show warning about hydrating Astro components in build (#5501)
Browse files Browse the repository at this point in the history
* Also show the warning in build when trying to hydrate an Astro component

* Add changeset
  • Loading branch information
Princesseuh authored Dec 1, 2022
1 parent 8450a09 commit 3c44033
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-lizards-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Added a warning in build when trying to hydrate an Astro component
4 changes: 2 additions & 2 deletions packages/astro/src/runtime/server/render/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { isPromise } from '../util.js';
import { renderChild } from './any.js';
import { HTMLParts } from './common.js';

// In dev mode, check props and make sure they are valid for an Astro component
// Issue warnings for invalid props for Astro components
function validateComponentProps(props: any, displayName: string) {
if (import.meta.env?.DEV && props != null) {
if (props != null) {
for (const prop of Object.keys(props)) {
if (HydrationDirectiveProps.has(prop)) {
// eslint-disable-next-line
Expand Down

0 comments on commit 3c44033

Please sign in to comment.