fix(scraps): Stop calling the tracking hook from inside Button (#122985)
Fixes `Rendered fewer hooks than expected. This may be caused by an
accidental early return statement.`
in `pnpm dev-ui`.
`TrackingContext` held a **hook**, and `useClickTracking` invoked it
inline during render:
```ts
const clickTracking = useContext(TrackingContext)();
```
The two implementations that can land in that context call different
numbers of hooks:
| implementation | hooks |
| --- | --- |
| `useDefaultButtonTracking` (`scrapsProviders/tracking.tsx`) | 0 |
| `useButtonTracking` (`gsApp/overrides/useButtonTracking.tsx`) | 2 —
`useOrganization`, `useMatches` |
So the hook count of `Button` and `Link` in the app depends on which
implementation
`getOverride('react-hook:use-button-tracking')` returns.
If that value ever changes, React sees a different number of hooks than
the previous render and throws. H
Hector Dearman committed
63618ec25f914f76bfcd14ca87241e42feb1de30
Parent: 946f25b
Committed by GitHub <noreply@github.com>
on 8/29/2026, 4:26:13 PM