Open abdelav opened 1 year ago
Let me test this in the demo app, will report back.
@abdelav did you notice this for other behavior actions, or only dispatch-event
?
I just tested with dispatch-event
so far, but let me test with other actions an I will report back.
I just tried it in the demo app and couldn't reproduce with dispatch-event
: https://github.com/Instawork/hyperview/compare/adam/test-event1?expand=1
https://user-images.githubusercontent.com/1034502/236074739-509e3beb-7408-4720-b10a-f1467232d01f.mp4
ok, this is probably an internal issue then?
Perhaps, message me privately with the issue so we can check.
Hello,
It looks like this might still be an issue. I have a <behavior />
with a trigger="change"
and action="dispatch-event"
which did not seem to be actually dispatching the event. After finding this issue and trying the delay="0"
workaround it started working straight away (thanks, @abdelav !).
Here is some log output with the two scenarios:
With delay="0"
INFO [behavior] | action: set-value | ["<behavior trigger=\"change\" action=\"set-value\" target=\"zoomHotTub\" new-value=\" \" ran-once=\"true\" xmlns=\"h ttps://hyperview.org/hyperview\"/>"]
INFO [behavior] | action: dispatch-event | ["<behavior trigger=\"change\" action=\"dispatch-event\" event-name=\"refresh-zoom-form\" delay=\"0\" ran-once=\ "true\" xmlns=\"https://hyperview.org/hyperview\"/>"]
INFO [dispatch-event] action [refresh-zoom-form] emitted. []
INFO [behavior] | action: replace | ["<behavior trigger=\"on-event\" event-name=\"refresh-zoom-form\" action=\"replace\" href=\"/zoomcontrol\" verb=\"post\ " target=\"zoomform\" once=\"true\" ran-once=\"true\" xmlns=\"https://hyperview.org/hyperview\"/>"]
INFO [on-event] trigger [ ["refresh-zoom-form", "] caught by: ", "<behavior trigger=\"on-event\" event-name=\"refresh-zoom-form\" action=\"replace\" href=\ "/zoomcontrol\" verb=\"post\" target=\"zoomform\" once=\"true\" ran-once=\"true\" xmlns=\"https://hyperview.org/hyperview\"/>"]
INFO [dispatch-event] action [zoom-updated] emitted. []
INFO [behavior] | action: replace | ["<behavior trigger=\"on-event\" event-name=\"zoom-updated\" action=\"replace\" href=\"/zoombutton\" once=\"true\" ran- once=\"true\" xmlns=\"https://hyperview.org/hyperview\"/>"]
INFO [on-event] trigger [ ["zoom-updated", "] caught by: ", "<behavior trigger=\"on-event\" event-name=\"zoom-updated\" action=\"replace\" href=\"/zoombutt on\" once=\"true\" ran-once=\"true\" xmlns=\"https://hyperview.org/hyperview\"/>"]
INFO [behavior] | action: dispatch-event | ["<behavior trigger=\"load\" action=\"dispatch-event\" event-name=\"zoom-updated\" once=\"true\" ran-once=\"true \" xmlns=\"https://hyperview.org/hyperview\"/>"]
Without delay="0"
INFO [behavior] | action: set-value | ["<behavior trigger=\"change\" action=\"set-value\" target=\"zoomHotTub\" new-value=\" \" ran-once=\"true\" xmlns=\"h ttps://hyperview.org/hyperview\"/>"]
INFO [dispatch-event] action [refresh-zoom-form] emitted. []
INFO [behavior] | action: dispatch-event | ["<behavior trigger=\"change\" action=\"dispatch-event\" event-name=\"refresh-zoom-form\" ran-once=\"true\" xmln s=\"https://hyperview.org/hyperview\"/>"]
As you can see, the action: dispatch-event
for the change event does appear in both logs, but the second is missing the expected [dispatch-event] action
line
Using the a behavior change trigger to dispatch an event on
<Text-field>
element is not working if the behavior doesn't have thedelay
attribute.Not working example:
working example: