Skip to content

ref(billing): Migrate spend notifications form to new form system#114303

Merged
TkDodo merged 11 commits intomasterfrom
tkdodo/ref/migrate-subscription-nofitications
May 4, 2026
Merged

ref(billing): Migrate spend notifications form to new form system#114303
TkDodo merged 11 commits intomasterfrom
tkdodo/ref/migrate-subscription-nofitications

Conversation

@TkDodo
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo commented Apr 29, 2026

Migrates the spend notifications threshold management page (/settings/billing/notifications/) from manual useState/useEffect state management with a raw <Select> and legacy FieldGroup to the new TanStack-based form system.

The page had two multi-select fields (subscription consumption thresholds and on-demand consumption thresholds) with Save/Reset buttons in the page header. The migration:

  • Replaces manual state management with useScrapsForm and fetchMutation
  • Replaces the raw <Select> + styled legacy FieldGroup with field.Select inside field.Layout.Row within a new-system FieldGroup
  • Moves Save/Reset buttons from the SettingsPageHeader action slot into the form body, using form.Subscribe for reactive dirty/valid state
  • Adds onChange validation with .min(1) on reservedPercent to prevent saving with no thresholds selected
  • Migrates data fetching from useApiQuery to apiOptions with useQuery
  • Removes the responsive breakpoint logic that duplicated the buttons — they now live in one place inside the form

The NotificationButtons, ThresholdInputs, and GenericConsumptionGroup components are collapsed into a single ThresholdsForm component since the separation was only needed when buttons lived in the header.

refs DE-1190

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 29, 2026
@TkDodo
Copy link
Copy Markdown
Collaborator Author

TkDodo commented Apr 29, 2026

bugbot run

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f042ae9. Configure here.

Comment thread static/gsApp/views/subscriptionPage/notifications.tsx Outdated
Comment thread static/gsApp/views/subscriptionPage/notifications.tsx Outdated
Comment thread static/gsApp/views/subscriptionPage/notifications.tsx Outdated
@TkDodo TkDodo marked this pull request as ready for review April 30, 2026 12:09
@TkDodo TkDodo requested a review from a team as a code owner April 30, 2026 12:09
@TkDodo TkDodo requested a review from a team April 30, 2026 12:09
Comment thread static/gsApp/views/subscriptionPage/notifications.tsx
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 1, 2026

# Conflicts:
#	static/gsApp/views/subscriptionPage/notifications.tsx
Comment thread static/gsApp/views/subscriptionPage/notifications.tsx
Comment thread static/gsApp/views/subscriptionPage/notifications.tsx
@TkDodo TkDodo merged commit ad0df4b into master May 4, 2026
71 checks passed
@TkDodo TkDodo deleted the tkdodo/ref/migrate-subscription-nofitications branch May 4, 2026 13:15
cleptric pushed a commit that referenced this pull request May 5, 2026
…14303)

Migrates the spend notifications threshold management page
(`/settings/billing/notifications/`) from manual `useState`/`useEffect`
state management with a raw `<Select>` and legacy `FieldGroup` to the
new TanStack-based form system.

The page had two multi-select fields (subscription consumption
thresholds and on-demand consumption thresholds) with Save/Reset buttons
in the page header. The migration:

- Replaces manual state management with `useScrapsForm` and
`fetchMutation`
- Replaces the raw `<Select>` + styled legacy `FieldGroup` with
`field.Select` inside `field.Layout.Row` within a new-system
`FieldGroup`
- Moves Save/Reset buttons from the `SettingsPageHeader` action slot
into the form body, using `form.Subscribe` for reactive dirty/valid
state
- Adds `onChange` validation with `.min(1)` on `reservedPercent` to
prevent saving with no thresholds selected
- Migrates data fetching from `useApiQuery` to `apiOptions` with
`useQuery`
- Removes the responsive breakpoint logic that duplicated the buttons —
they now live in one place inside the form

The `NotificationButtons`, `ThresholdInputs`, and
`GenericConsumptionGroup` components are collapsed into a single
`ThresholdsForm` component since the separation was only needed when
buttons lived in the header.

refs DE-1190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants