You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Stackflow activities' enter transition is only expressed with enter-active and enter-done. However, this doesn't work well with frameworks that do concurrent rendering because the core state update happens regardless of whether activities render synchronously or suspend during render. This results in something like this:
sequenceDiagram
participant Core as @stackflow/core
participant Integration as Integration (@stackflow/react)
participant View
View->>Core: push()
activate Core
note left of Core: Transition
Core->>Integration: notify on subscribe() listener
Integration->>Core: getStack()
Core->>Integration: State with `enter-active`
Integration->>View: Render new activity with `enter-active`
activate View
note right of View: Suspend
Core->>Integration: notify on subscribe() listener
deactivate Core
Integration->>Core: getStack()
Core->>Integration: State with `enter-done`
Integration->>View: Rerender with `enter-done`
deactivate View
note right of View: Initial render with `enter-done`
Loading
As described above, if the view suspends longer than the core transition, the initial render of the view is done with enter-done state, resulting in broken CSS transitions.
To mitigate this, the core transition should be started after confirming that the initial view was rendered. These are the required parts to implement the feature:
Add a new transition state to express activities that didn't complete the initial render. (enter-pending?)
Add a new action that notifies the core after completing the initial render. (no idea about naming 🥲)
I'm willing to implement the feature after the direction is fixed.
Rather than adding a transition state, I think it's better to ditch the setInterval logic that changes from enter-active to enter-done and create an interface that can be manipulated in intergration. Additionally, I think it's okay to ditch the enter-active/enter-done state and just have the enter state. Currently, we can't manipulate the state inside core to respond to animationcancel event or React.Suspense, and I think it can better implement logic specific to each UI library if we touch the animation state in intergration.
Currently, Stackflow activities' enter transition is only expressed with
enter-active
andenter-done
. However, this doesn't work well with frameworks that do concurrent rendering because the core state update happens regardless of whether activities render synchronously or suspend during render. This results in something like this:As described above, if the view suspends longer than the core transition, the initial render of the view is done with
enter-done
state, resulting in broken CSS transitions.To mitigate this, the core transition should be started after confirming that the initial view was rendered. These are the required parts to implement the feature:
enter-pending
?)I'm willing to implement the feature after the direction is fixed.
Related: #434
The text was updated successfully, but these errors were encountered: