Before migrating to V6 all works fine.
After migration dom.value = props.value; fails, because dom is null.
function updateChildOption(vNode, value) {
var props = vNode.props || EMPTY_OBJ;
var dom = vNode.dom;
// we do this as multiple may have changed
dom.value = props.value;
if ((isArray(value) && value.indexOf(props.value) !== -1) || props.value === value) {
dom.selected = true;
}
else if (!isNullOrUndef(value) || !isNullOrUndef(props.selected)) {
dom.selected = props.selected || false;
}
}
This happens when we will use our own (functional) component to render the option tag and use
export const Combobox= (props) => {
const FncOption = () => <option />;
return <select id="foobar">
<FncOption/>
</select>;
}
Removing the property from the select tag or using \
This dosn't happen when using className.
export const Combobox= (props) => {
const FncOption = () => <option />;
return <select className="foobar">
<FncOption/>
</select>;
}
Thx
Hi @chrkulbe
Thanks for reporting the issue. I will look into it.
@chrkulbe
This is indeed bug I will fix it and release a patch.
On a side note:
Its not good practice to declare Component inside another Component render if it was not just to show case the bug.
export const Combobox= (props) => {
// This component will be created again in every render of ComboBox, because it is different Component each time
const FncOption = () => <option />;
return <select className="foobar">
<FncOption/>
</select>;
}
This is better practice.
// Now because its hoisted, it will be created only once and updated when Combobox renders
const FncOption = () => <option />;
export const Combobox= (props) => {
return <select className="foobar">
<FncOption/>
</select>;
}
I know, it was only for the show case. :o)
Fixed, 6.0.2 released :)