-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui-switch: sync issue #1572
ui-switch: sync issue #1572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff as always @bartbutenaers
This (I assume it is this) appears to have broken the switch when passthrough is not enabled and Show State of Input is selected.
|
@colinl I will try to find some time tonight to have a look at your flow. |
I keep meaning to look at how the unit tests work with a view to contributing. I am (metaphorically) snowed under at the moment though, but I will bump it up my priority list. |
@colinl, I have installed the release from yesterday (1.22) but at first sight I cannot see an issue. Could you explain a bit in more detail what is going wrong? Thanks!! |
I have the latest version installed: But it "looks" normal to me: I am going to put this aside, and wait for instructions how I can reproduce it. |
Well, this is embarrassing. I could have sworn the flow I posted had Show State of Input, but I was wrong. I am really sorry to have wasted your time Bart. Now my brain is working again I see that it is all working exactly as expected. |
Completely no problem @colinl!! |
Description
When a ui-switch is displayed in two dashboards, their state seems not to be synced anymore. I assume that bug has been introduced by PR 1463.
It nows seems to be fixed by this PR:
The problem was caused because the ui-switch node had overridden the default
onChange
handler, but that handler was not refactored to push the newwidget-sync
event to the frontend. So theonSync
function in the ui-switch Vue file was never called.It was a bit more work as expected, because the default handler function (in ui-base) did not have a
conn
orid
parameter. Instead it used - via closure - those parameters from the parent function. In order to have those parameters available in the ui-switch overridden onChange function, I had to add them as parameters. To make sure there are no breaking changes for third-party ui nodes, I have added the two new parameters at the end of the parameter list.To be honest, I don't have a very good feeling with this one. The default handler functions are becoming more complex, and code needs to be duplicated every time. If you forget to keep the duplicated code in sync with all changes, you end up with issues like this one. Moreover existing third-party ui nodes won't use this new approach automatically. And if the third-party developer manually refactors his code to use the new mechanism, he will get breaking changes when his ui node is being used on an older dashboard version.
So it would be really useful if all the sync-related mechanisms could be finalized in the near future, to reduce the number of fixes and to avoid too much (repetetive) refactoring work. Imho that is quite high priority to get things stable... Thanks!!!
Related Issue(s)
1569: solves only one of the two problems in that ticket
Checklist
flowforge.yml
?FlowFuse/helm
to update ConfigMap TemplateFlowFuse/CloudProject
to update values for Staging/ProductionLabels
area:migration
label