dreamcatcher-tech / dreamcatcher-stack

https://dreamcatcher.land
1 stars 0 forks source link

calling `setState()` on a child and then `rm` within the same pulse causes and error #173

Open inverted-capital opened 7 months ago

inverted-capital commented 7 months ago

This is a legitimate call pattern, but the error occurs presumably because of some post processing that happens after all pulses have been created, and it finds that the channelId no longer exists.

This might be solved by marking the channel as pending deletion, and only deleting as the last thing in pulse making.

This will cause problems with actions sent to children, that can no longer reply nor update anything since they have been deleted.

We could avoid both problems by only doing the rm once the child has acknowledged the removal, signally the child has cleaned everything up. Any outstanding promises from the child to other chains would need to be cleaned up as well.