Runtime exception when running two hooks components at the same time
Closed this issue · 1 comments
Hi! First of all thanks a lot for this great project, I really like the idea :).
We are running into a weird runtime exception when having 2 hooks components running side by side:
The screenshot above corresponds to the Simulation pane of a tool called Marlowe Playground. The page has 5 components called currencyInput
(highlighted in red) and one component called instantInput
(highlighted in green). For some reason, if the instantInput
raises an output the currencyInput
receives unexpected data (highlighted in red) which results in the runtime exception.
If I comment the line that raises the output for InstantInput
then I don't have this problem
One caveat of this project: It is using custom helpers we call sub-modules, which emulates the Elm architecture with Lenses. We made this as a way to have global state before you created halogen-store. In another project in the same repo we are not using the sub-components anymore thanks to your library <3.
Steps to reproduce
This can be reproduced in the debug-halogen-hooks
branch of the repo. It is necessary to use nix-shell with the binaries cache preconfigured. Then follow these steps to launch the playground client (the backend is not needed for this).
After the page is running on localhost, you can:
- Open an example
- Select "Escrow - Marlowe"
- Click "Send to simulator"
- The runtime error appears in the console
Thanks for the report, @hrajchert. I haven't seen this happen before.
If I'm following correctly, you have:
- an
instantInput
that is raising an output message to some parent - that parent is passing the value of that output message down to
currencyInput
as input - the input, when it reaches
currencyInput
, is undefined
I'm pressed for time this week so it's difficult for me to set up your reproduction, but I am curious what happens if you trace the value through each of those steps and pinpoint the moment in which it becomes undefined. When I have some more time I can help dig into exactly what's going on.