Closed adamf-datapath closed 4 months ago
Just tested your example flow, can confirm that it happens.
One work-around is to define an empty option
on the node config...
It seems to remove that error.
Strange never had found that error, well, by default when we add a new Dropdown node to the dashboard the node by default has one empty option
, unless we remove it the error would not trigger.
Another semi-related issue is that when we send a msg with options
as being an empty array this error does not show.
Hmm not sure how to fix this, because I have never used the ui-control node myself.
Seems to be 2 different problems.
The 2 options are extracted correctly from the input message, and returned by the computed options
property:
Which should trigger the label to be hidden:
Although I 'think' that the first ?
is a typo? I did remove it, but the label is still being displayed.
This is what happens:
The ui-control node injects this message:
Which arrives in the recently added dynamic property mechanism:
The options are correctly extracted from the message:
But then the node tries to determine which of these options need to be selected, by looking at the payload:
Since the msg.payload value is not available in the list of options, nothing will be selected.
So I assume the input message payload should be fixed by the user's flow? Although imho it would be user friendly to show a node.error
that the msg.payload
contains no valid option...
Regarding the first problem, i would say the error is in this line:
I think it should be:
:error-messages="options?.length ? '' : 'No options available'"
since after we send a message with the options
field, the item list is in variable items
that is fetched by the compute propriety options
.
Making this change (tested on vuetify playground), it seems that the warning red color
will appear in case we send a message with options
as an empty array, and in case the node config windows doesn't have any option. Will be refreshed after we send a message with options
at startup.
I don't think the 2 problem, is a really "issue". Having no value selected, in the example flow that indeed happens because the payload
is not valid considering the options
, I would argue that the user should send a valid payload or not send any payload.
In my opinion it is valid that I may only want to update the options
(Item List) without assigning any value. And, it would be useful to have some way to purposely clear the comboBox and return to the original state (with no item selected).
I think it should be
Yes you are correct that is the one. Build and tested it, and then it works. Thanks!! I have created a pull request.
In my opinion it is valid that I may only want to update the options (Item List) without assigning any value
Yes true. But if you inject a payload with an invalid content, imho it would be userfriendly to show a warning in the sidebar.
In my opinion it is valid that I may only want to update the options (Item List) without assigning any value
Yes true. But if you inject a payload with an invalid content, imho it would be userfriendly to show a warning in the sidebar.
Yes agree, the same way other nodes send error
/warn
messages to the debug tab.
Although the action of sending only the options
should maybe also clear the Dropdown value, specially if the selected value is not present in the new options to avoid inconsistency.. Or maybe more simple to have a way to clear the selection, like an empty string on payload. Disregard this commentary, just notice it that is necessary to send an empty array.
Current Behavior
When providing options dynamically to ui-dropdown by setting
msg.options
, the rendered dropdown states there are "No options available", even though there are.Expected Behavior
Dropdown does not warn about no options available.
Steps To Reproduce
msg.options
) to ui-dropdown, in response to ui-event.Reproduction:
Environment
Have you provided an initial effort estimate for this issue?
I am not a FlowFuse team member