r/purescript • • Oct 11 '17

Halogen destroyed components

I've gone through the Halogen guide and am still trying to wrap my head around how it all works. My questions at the moment are about deletion; consider the TODO example that comes with Halogen:

  1. When a task is removed from the todo list, the parent render function no longer performs a slot call for that task. Does all information for that task get destroyed at that point?
  2. Can that task id be reused at some later point in time?
  3. What happens if a removed component had say an AJAX request in flight?
4 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/natefaubion Oct 12 '17

To expand on canceling requests, there is no way to get a reference to currently evaluating threads to cancel them. Any coordination would have to be done through component state. One possible way to coordinate cancellation would be through an AVar. Aff v4 provides other means to do this (via Fiber), but there isn't a Halogen release yet to work with Aff v4.

2

u/natefaubion Oct 12 '17

Actually, I take this back. You can use fork within HalogenM and get a canceler back.