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:
parent
8450a09f14
commit
3c44033e4e
2 changed files with 7 additions and 2 deletions
5
.changeset/yellow-lizards-shout.md
Normal file
5
.changeset/yellow-lizards-shout.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Added a warning in build when trying to hydrate an Astro component
|
|
@ -8,9 +8,9 @@ import { isPromise } from '../util.js';
|
||||||
import { renderChild } from './any.js';
|
import { renderChild } from './any.js';
|
||||||
import { HTMLParts } from './common.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) {
|
function validateComponentProps(props: any, displayName: string) {
|
||||||
if (import.meta.env?.DEV && props != null) {
|
if (props != null) {
|
||||||
for (const prop of Object.keys(props)) {
|
for (const prop of Object.keys(props)) {
|
||||||
if (HydrationDirectiveProps.has(prop)) {
|
if (HydrationDirectiveProps.has(prop)) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
|
Loading…
Add table
Reference in a new issue