direflow
direflow copied to clipboard
Property value "empty string" is converted to "true"
Describe the bug
When passing a property to the web component as an empty string, the string is converted into a boolean "true".
<my-component myProperty="" />
Passing this to my react-component, I get the value 'true' as a boolean for that property. In version 3.4.13 everything worked as expected, the value of myProperty was an empty string. But when upgrading to 3.5.1 we noticed the issue.
Expected behavior
The value should still be an empty string.
Assumption I couldn't look into it in full details yet, but it might be related to the changes from PR #161 where to WebComponentFactory the method "getSerialized" was added:
const getSerialized = (data: string) => {
if (data === '') {
return true;
}
...
}
which seems to treat an string as true? Is there a reason for the change of behavior or is it accidental?
Hi @0815Strohhut Thank you for creating this issue.
Yeah, I see what the problem is here. It is an unfortunate side effect to this issue: #125 as was indeed introduced in version 3.5.
This should be considered a bug, yes. We'll make sure to look into this as soon as possible.
Is there any workaround for this issue? I am running into it too, almost 6 months after it was reported.