Show warning about hydrating Astro components in build (#5501)

* Also show the warning in build when trying to hydrate an Astro component

* Add changeset
This commit is contained in:
Erika 2022-12-01 12:41:37 -04:00 committed by GitHub
parent 8450a09f14
commit 3c44033e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Added a warning in build when trying to hydrate an Astro component

View file

@ -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