Skip to content

ref(hookStore): Change HookStore to single-value semantics#115796

Merged
evanpurkhiser merged 2 commits into
masterfrom
evanpurkhiser/ref-hookstore-change-hookstore-to-single-value-semantics
May 19, 2026
Merged

ref(hookStore): Change HookStore to single-value semantics#115796
evanpurkhiser merged 2 commits into
masterfrom
evanpurkhiser/ref-hookstore-change-hookstore-to-single-value-semantics

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

HookStore.get() previously returned an array of registered callbacks,
but in practice only a single callback was ever registered per hook
name. The registration pattern (object literal keys in GETSENTRY_HOOKS,
and the remove-then-add pattern in GSBillingNavigationConfig) already
guaranteed at most one callback per slot.

Tighten the types to reflect reality:

  • get() returns Hooks[H] | undefined instead of Array<Hooks[H]>
  • add() is renamed to set() and overwrites instead of pushing
  • remove() no longer takes a callback argument — it just clears the slot

All consumers updated: [0] indexing gone, .forEach/.map loops replaced
with single optional calls.

@evanpurkhiser evanpurkhiser requested review from a team as code owners May 19, 2026 14:35
@evanpurkhiser evanpurkhiser requested a review from a team May 19, 2026 14:35
@evanpurkhiser evanpurkhiser requested review from a team as code owners May 19, 2026 14:35
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.56% 93.56% ±0%
Typed 135,565 135,552 🔴 -13
Untyped 9,338 9,335 🟢 -3
🔍 2 new type safety issues introduced

any-typed symbols (1 new)

File Line Detail
static/app/components/hook.tsx 60 HookComp (var)

Type assertions (as) (1 new)

File Line Detail
static/app/components/hook.tsx 60 as React.ComponentType<any>hookCallback as React.ComponentType<any>

This is informational only and does not block the PR.

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 1 potential issue.

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 0bd87e0. Configure here.

Comment thread static/app/views/app/index.spec.tsx
HookStore.get() previously returned an array of registered callbacks,
but in practice only a single callback was ever registered per hook
name. The registration pattern (object literal keys in GETSENTRY_HOOKS,
and the remove-then-add pattern in GSBillingNavigationConfig) already
guaranteed at most one callback per slot.

Tighten the types to reflect reality:
- get() returns Hooks[H] | undefined instead of Array<Hooks[H]>
- add() is renamed to set() and overwrites instead of pushing
- remove() no longer takes a callback argument — it just clears the slot

All consumers updated: [0] indexing gone, .forEach/.map loops replaced
with single optional calls.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/ref-hookstore-change-hookstore-to-single-value-semantics branch from 0bd87e0 to 1dd58cd Compare May 19, 2026 15:07
@evanpurkhiser evanpurkhiser merged commit df8cae1 into master May 19, 2026
71 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/ref-hookstore-change-hookstore-to-single-value-semantics branch May 19, 2026 15:31
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