Skip to content

ref(project-creation): Extract shared hooks from the notification components#118581

Merged
jaydgoss merged 3 commits into
masterfrom
jaygoss/extract-messaging-alert-rule-hook
Jun 30, 2026
Merged

ref(project-creation): Extract shared hooks from the notification components#118581
jaydgoss merged 3 commits into
masterfrom
jaygoss/extract-messaging-alert-rule-hook

Conversation

@jaydgoss

@jaydgoss jaydgoss commented Jun 26, 2026

Copy link
Copy Markdown
Member

TLDR

Pull the reusable logic out of the classic notification components into shared hooks so an SCM-styled layout can reuse it. No behavior change to the classic project-creation flow.

Details

  • Extract useMessagingIntegrationAlertRule (the channel query, validation, and the provider/integration/channel options and handlers) from MessagingIntegrationAlertRule, and export ChannelSelect and ChannelField. The classic rule consumes the hook and renders the same inline grey card.
  • Extract useIssueAlertNotificationOptions from IssueAlertNotificationOptions (the shouldRenderNotificationConfigs derivation, the setup-button impression analytics, and the querySuccess gate). The classic component consumes the hook and renders identically.
  • Tag the new exports @public so knip doesn't flag them while their second consumer (the SCM layout) is still in the PR stacked on top of this one.

@jaydgoss jaydgoss requested a review from a team as a code owner June 26, 2026 18:32
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.82% 93.82% ±0%
Typed 133,334 133,364 🟢 +30
Untyped 8,780 8,782 🔴 +2
🔍 5 new type safety issues introduced

any-typed symbols (4 new)

File Line Detail
static/app/views/projectInstall/messagingIntegrationAlertRule.tsx 114 option (param)
static/app/views/projectInstall/messagingIntegrationAlertRule.tsx 120 option (param)
static/app/views/projectInstall/messagingIntegrationAlertRule.tsx 209 onProviderChange (var(binding))
static/app/views/projectInstall/messagingIntegrationAlertRule.tsx 210 onIntegrationChange (var(binding))

Non-null assertions (!) (1 new)

File Line Detail
static/app/views/projectInstall/messagingIntegrationAlertRule.tsx 116 providersToIntegrations[option.value]!

This is informational only and does not block the PR.

@jaydgoss jaydgoss marked this pull request as draft June 26, 2026 18:51
@jaydgoss jaydgoss changed the title ref(project-creation): Extract a hook from the messaging alert rule ref(project-creation): Extract shared hooks from the notification components Jun 26, 2026
@jaydgoss jaydgoss marked this pull request as ready for review June 26, 2026 19:22
@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from 7f153aa to 37b2315 Compare June 26, 2026 19:39
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from 336815c to 5a20cb4 Compare June 26, 2026 19:39
@sentry

sentry Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 451 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from 37b2315 to be81f9e Compare June 26, 2026 19:46
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from 5a20cb4 to bd1be2b Compare June 26, 2026 19:46
@jaydgoss jaydgoss requested a review from a team June 26, 2026 20:45
Comment on lines +103 to +135
return {
provider,
integration,
channel,
providerOptions,
integrationOptions,
channelOptions,
isChannelLoading: isPending || validateChannel.isFetching,
channelError: validateChannel.error,
providerDisabled: Object.keys(providersToIntegrations).length === 1,
integrationDisabled: integrationOptions.length === 1,
onProviderChange: (option: any) => {
setProvider(option.value);
setIntegration(providersToIntegrations[option.value]![0]);
setChannel(undefined);
validateChannel.clear();
},
onIntegrationChange: (option: any) => {
setIntegration(option.value);
setChannel(undefined);
validateChannel.clear();
},
onChannelChange: (option: {label: React.ReactNode; value: string} | null) => {
setChannel(
option ? {value: option.value, label: option.label, new: false} : undefined
);
validateChannel.clear();
},
onCreateChannel: (newOption: string) => {
setChannel({value: newOption, label: newOption, new: true});
},
};
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wondering if we should have an explicit type with comments for this stuff. Just a though, not a requirement

@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from be81f9e to fb1f238 Compare June 29, 2026 20:55
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from bd1be2b to 37e423c Compare June 29, 2026 20:55
@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from fb1f238 to 050e09e Compare June 29, 2026 21:55
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from 37e423c to 66f5541 Compare June 29, 2026 21:55
@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from 050e09e to 0131e54 Compare June 29, 2026 22:50
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from 66f5541 to 710919e Compare June 29, 2026 22:50
@jaydgoss jaydgoss force-pushed the jaygoss/scm-alert-notification-options branch from 0131e54 to 7d5e693 Compare June 30, 2026 15:59
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from 710919e to f00a0c4 Compare June 30, 2026 15:59
Base automatically changed from jaygoss/scm-alert-notification-options to master June 30, 2026 16:40
jaydgoss added 3 commits June 30, 2026 11:43
Pull the channel query, channel validation, and the provider/integration/channel options and change handlers out of MessagingIntegrationAlertRule into a shared useMessagingIntegrationAlertRule hook, and export ChannelSelect and ChannelField. The classic component consumes the hook and renders the same inline card. This lets an SCM-styled rule reuse the logic without duplicating it.
The hook, ChannelSelect, and ChannelField are exported for reuse by the SCM layout, which lands in a stacked PR. Tag them @public so knip does not flag them as unused while their only external consumer is still downstream.
Pull the shared shell out of IssueAlertNotificationOptions into a useIssueAlertNotificationOptions hook: the shouldRenderNotificationConfigs derivation, the setup-button impression analytics, and the querySuccess gate. The SCM layout can reuse the same logic and analytics instead of duplicating them. The classic component consumes the hook and renders identically.
@jaydgoss jaydgoss force-pushed the jaygoss/extract-messaging-alert-rule-hook branch from f00a0c4 to ea55b39 Compare June 30, 2026 16:49
@jaydgoss jaydgoss merged commit f5b251b into master Jun 30, 2026
78 checks passed
@jaydgoss jaydgoss deleted the jaygoss/extract-messaging-alert-rule-hook branch June 30, 2026 17:06
jaydgoss added a commit that referenced this pull request Jun 30, 2026
## TLDR

Add an SCM-styled version of the notification options for the
alert-frequency section. The messaging-integration rule lays out one
sentence fragment per row with full-width inputs and no grey card
background, and reveals with the shared collapse animation. Builds on
#118581.

## Details

- Add `ScmMessagingIntegrationAlertRule`, which reuses the
`useMessagingIntegrationAlertRule` hook (from #118581) and renders
`makeSentence` in a flat `Flex` column, so each fragment ("Send", the
provider select, "notification to the", and so on) sits on its own
full-width row, without the `background.secondary` card styling.
- Add `ScmIssueAlertNotificationOptions`: a "Notify via" header above
"Email" and "Integration (Slack, Discord, MS Teams, etc.)" checkboxes
that renders the stacked rule, replacing the direct use of the shared
picker in `ScmAlertFrequencySection`. The checkboxes are composed
directly from the scraps `Checkbox` (not `MultipleCheckbox`) so they
stack full width.
- The rule reveals with `ScmCollapsibleReveal` (height and fade) when
Integration is checked and indents under its checkbox label. The long
Integration label and the section footer truncate with an ellipsis on
narrow screens.
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