# fix\(mobile\): reconcile app state at first ambient-signal subscription · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/311d54d4cdbb83bede0a55523f0c91fc5b27d93f)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 311d54d4cdbb83bede0a55523f0c91fc5b27d93f

Requested commit: 311d54d4cdbb83bede0a55523f0c91fc5b27d93f

Commit: 311d54d4cdbb83bede0a55523f0c91fc5b27d93f

Tree: c7c3264cec43388b30704ed911a3287ee9e1a44e

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(mobile): reconcile app state at first ambient-signal subscription

The store snapshotted `AppState.currentState` at module load and only
tracked transitions delivered to its listener. A background transition
that happened before the first consumer mounted (cold launch to the app
switcher, deep link landing blurred) left the stored value at "active",
so the first ambient loop could start offscreen.

`subscribeToPlatformSignals` now registers the AppState listener first
and then folds the platform's current value; transitions landing in
between are covered by the listener. Focused tests cover both orderings
with a fresh module instance per case.

```

## Parents

- [29473eb3b149bb592cbddd08e3585580b17a6684](https://git.cafe/pingdotgg/t3code/commit/29473eb3b149bb592cbddd08e3585580b17a6684?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/311d54d4cdbb83bede0a55523f0c91fc5b27d93f?format=markdown)
