When you click the "Done" button of the config screen, the oneditsave is triggered where the string "true" from the html element is converted back to a boolean true and stored in this node:
So I expect the node state is again the same as in the beginning.
But when you double-click the node again, the value in the oneditpreare seems to have become a string "true" (although we have stored in the previous step a boolean true):
The switching between the boolean and string values results in the node becoming dirty, and the "Deploy" button becoming active.
Does anybody know why the stored boolean value becomes a string? I assume it is being stored as a string value, because the loading works fine the first time.
Not really followed that closely but my suspicion is that the boolean is being added as an HTML element attribute? If so, attributes are always strings. So you need to convert it back.
I think, (not tried) the converting should be removed from editor and the actual usage of that property in vue should be made by using computed value. But may introduce breaking change...
Morning @hotNipi,
It is from the config screen, not the vue file. So the computed fields are not applicable to this issue. Too long ago that I wrote this kind of code, so a bit confused what is the best practice. My knowledge seems to be fading away...
I'll try once more...
The usage of that property is in vue. The type of the property should be even string ('always') or boolean.
The converting in config is unnecessary if the property usage will be via computed value.
Let the it be string ("always", "true", "false") and use computed value in vue where you then convert "true" or "false" to actual boolean.
Ok, thanks. Seems my brain is not fully awake yet. That makes sense yet.
But would like to understand what is wrong with Joe's code, because I don't see it. The default value is a boolean, and that arrives as a boolean in the oneditprepare. But afterwards it can never be a boolean again, only a string boolean? Was that normal behaviour of node properties? Joe is using boolean node properties all over the place, so I don't understand why this one causes an issue for some user.
I think Joe was trying also to avoid breaking changes. Previous iteration had checkbox to even show or hide. The input element is now select and for that the handling is different thus the property needed to be converted. But as we know now, the converting in config has that nasty side-effect.
So the properties in this are simply the default values (with the correct types), assigned by the flow editor to my new node. But I had expected value "false" instead of "on"....
The second time I arrive in the oneditprepare I get these values:
So the properties in this are simply the default values (with the correct types), assigned by the flow editor to my new node.
I change all 3 html input fields, and press the "Done" button.
In the oneditsave the this properties still contains the original values, but the html input elements contain the new updated values: