mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
update Component to error if 'tag' attribute is passed - messes with mithril
This commit is contained in:
committed by
Franz Liedke
parent
fcda092558
commit
b78db0268a
@@ -66,12 +66,18 @@ export default abstract class Component<T extends ComponentAttrs = any> implemen
|
||||
private setAttrs(attrs: T = {} as T) {
|
||||
this.initAttrs(attrs);
|
||||
|
||||
if (attrs && 'children' in attrs) {
|
||||
throw new Error(
|
||||
`[${
|
||||
(this.constructor as any).name
|
||||
}] The "children" attribute of attrs should never be used. Either pass children in as the vnode children or rename the attribute`
|
||||
);
|
||||
if (attrs) {
|
||||
if ('children' in attrs) {
|
||||
throw new Error(
|
||||
`[${
|
||||
(this.constructor as any).name
|
||||
}] The "children" attribute of attrs should never be used. Either pass children in as the vnode children or rename the attribute`
|
||||
);
|
||||
}
|
||||
|
||||
if ('tag' in attrs) {
|
||||
throw new Error(`[${(this.constructor as any).name}] You cannot use the "tag" attribute name with Mithril 2.`);
|
||||
}
|
||||
}
|
||||
|
||||
this.attrs = attrs;
|
||||
|
Reference in New Issue
Block a user