# fix\(mobile\): adding an environment no longer crashes while connecting · pingdotgg/t3code

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

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

Visibility: public

Requested revision: aaa7380015abcf64411a887d28a596b52367001c

Requested commit: aaa7380015abcf64411a887d28a596b52367001c

Commit: aaa7380015abcf64411a887d28a596b52367001c

Tree: b7daec6e487191c3301337371cc88ba827299c11

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
fix(mobile): adding an environment no longer crashes while connecting

Tapping connect on Add environment swaps the checkmark for a spinner, a
custom header item. Since #21095 the toolbar's items feed the native stack
options signature, which walked every enumerable field. In development a
React element's `_owner` is a fiber, so the walk climbed the whole tree
to React Navigation's NavigationStateContext. Outside render that context
holds its default value, whose getters throw "Couldn't find a navigation
context". The red box pointed at StackHeader.tsx:148 only because that is
the component frame for NativeStackScreenOptions.

The options helpers no longer walk React's internals. Elements are compared
by type, key, and props. Component types and contexts are compared by
identity and kept as-is when header factories are stabilized. Sheet headers
with trailing or loading custom items went through the same path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

```

## Parents

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

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