diff --git a/.changeset/lucky-comics-bow.md b/.changeset/lucky-comics-bow.md new file mode 100644 index 000000000..92af2ec29 --- /dev/null +++ b/.changeset/lucky-comics-bow.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +check if class:list's value is defined before converting diff --git a/packages/astro/src/runtime/server/hydration.ts b/packages/astro/src/runtime/server/hydration.ts index 436e19f3c..cb26b72e8 100644 --- a/packages/astro/src/runtime/server/hydration.ts +++ b/packages/astro/src/runtime/server/hydration.ts @@ -92,8 +92,10 @@ export function extractDirectives(inputProps: Record): Ext } } } else if (key === 'class:list') { - // support "class" from an expression passed into a component (#782) - extracted.props[key.slice(0, -5)] = serializeListValue(value); + if (value) { + // support "class" from an expression passed into a component (#782) + extracted.props[key.slice(0, -5)] = serializeListValue(value); + } } else { extracted.props[key] = value; }