(solved) Expected behaviour with messages from slotted components?


in a Halogen page I noticed that messages I raise in a slotted child-component get delayed in the parent components handleAction queue when some other action there is still waiting for an async handler to return.

In my special case I request some resources via Affjax on page-init but the user should be able to interact with the rest of the page while waiting.

I use quite a few sub-components on there and in the message/action loop of those all is fine (it raises the output and the raise HalogenM action finishes) but the action is only handeled (the handler is only evoked) after the initial affjax Aff finishes.

Other (non-async - I did not test other async effects in those handlers) actions directly from the parent-component are interleaved and handled in the parents action-loop just as those for the sub-components are in the sub-comonents action loop (I tested this with various console.log trace messages so I can see the timeline via the browsers log).

Is this a expected behaviour? Is there some workaround for this (for the user it looks as if the App is not responsive during the wait which somewhat defeats the async aspect).

Thanks for your help.

… omg … yeah stupid me - I misplaced the Halogen.fork in the Initializer so the asyc Affjax request was blocking eval - sorry my bad

1 Like

Ah, understandable!

I sometimes wonder if the blocking initializer does more harm than good, it would possibly be better to opt-in rather than opt-out (via fork). Or just remove it entirely, I think I can can count on one hand the number of times I truly needed the behaviour, and although it wouldn’t be super pleasant, it could be manually implemented in the component itself with some AVar trickery.

1 Like

Don’t worry - I think it is fine (it is well documented) - I was just puzzled because of my own mistake.