-
Notifications
You must be signed in to change notification settings - Fork 107
Description
According to the official documentation, the useStack() hook can be used to access the stack state within UI components. However, when examining the activities array returned from useStack(), I noticed that its length increases by one each time the push or replace functions are called, and does not decrease when the pop function is invoked.
It is true that by checking properties such as transitionState, isTop, or isActive, one can determine which screen the user is currently viewing. Still, if the user repeatedly performs push or replace operations, the array continues to grow regardless of what the user actually sees. Intuitively, in scenarios such as when the user has finished navigating and returned to the root activity, one would expect the array to reset. Without some form of cleanup, the length of the array could, at least in theory, grow without bound.
As far as I know, Stackflow does not currently provide an API to reset or trim the stack state array in this manner. Of course, since Stackflow is obviously well-designed to be easily extended and customized through plugins, I imagine it would not be very difficult for me to implement additional functionality by myself if needed. That said, before proceeding, I would like to confirm whether my understanding aligns with the framework’s intended design. Or am I perhaps misunderstanding how the lifecycle of the stack is meant to be managed?