fix: 🐛 BUG: class:list directive adding class attribute when undefined (#4867)
* Update hydration.ts * Create lucky-comics-bow.md
This commit is contained in:
parent
5fc73ba02c
commit
03e8b750ad
2 changed files with 9 additions and 2 deletions
5
.changeset/lucky-comics-bow.md
Normal file
5
.changeset/lucky-comics-bow.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
check if class:list's value is defined before converting
|
|
@ -92,8 +92,10 @@ export function extractDirectives(inputProps: Record<string | number, any>): 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue