I'm trying to resolve a bug and it makes me think I'm missing something fundamental about the lifecyle of Actions.
Here's my scenario:
I have page that displays the details of an object. There's a command (on a bottom sheet) that allows that item to be deleted. Once the item has been deleted, I automatically navigate the user to a page where they can create a new object. This seems to work fine. But I've gotten at least one bug report (in private beta) and seen it occasionally myself (but rarely) that the navigation step fails.
So, to fix this, I changed the order in which things are done. Since I always want to navigate the user to a new page after they hit "Delete" on the current page, I moved the navigate action to the very top of the action tree. And then the various delete operations (the object is connected to subcollections which I clean up as part of the parent object deletion) happen after the navigation.
In practice, this works fine and I've never had it fail. Navigation works 100% of the time. And the various firestore delete operations also work 100% of the time. No errors. BUT....
...I was feeling like maybe it SHOULDN'T work or that maybe it would fail under bad network conditions and I was just getting lucky because all the operations were happening super quickly on my machine.
So I tried something to test my "this is lucky, don't trust it to work" theory, and here's where the issue is...
On the page where the object is getting deleted, I added some debugging actions on my delete command. In particular, I added a periodic action that would increment an app state variable every second. So the full sequence is:
User hits the delete button
Periodic action is triggered
User is automatically navigated to a new page
With this sequence, I expected that the periodic action would continue counting in the background even though I'd navigated to a new page. I expected this because the Firestore delete operations seemed to be executing just fine, even though I was no longer on the page that triggered the deletion action. I've also seen notes from FF product team saying "be sure to stop your periodic actions to conserve system resources", which led me to believe that actions continue to stay alive even if the page that triggered them has been disposed.
So... what should I expect when triggering an action on Page A and then navigating to Page B? Should I expect the actions triggered on Page A to:
(x) Terminate when I go to Page B
(y) Continue when I go to Page B
(z) Terminate or Continue based on what type of action it is