Skip to content

ref(integrations): Refactor useAddIntegration to accept params at call time#112876

Draft
jaydgoss wants to merge 1 commit intomasterfrom
jaygoss/vdy-69-add-integration-ref
Draft

ref(integrations): Refactor useAddIntegration to accept params at call time#112876
jaydgoss wants to merge 1 commit intomasterfrom
jaygoss/vdy-69-add-integration-ref

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

@jaydgoss jaydgoss commented Apr 13, 2026

Refactors useAddIntegration so that startFlow() accepts all params (provider, organization, onInstall, etc.) at call time instead of at hook initialization. This lets a single hook instance launch flows for any provider, which is needed for multi-provider UIs like dropdowns where the provider isn't known until the user clicks.

The hook now manages its own message event listener via refs, eliminating the need for a context provider (PostMessageProvider) at call sites.

Other changes:

  • Moved hook from views/settings/organizationIntegrations/ to utils/integrations/
  • Extracted computeCenteredWindow to utils/window/
  • Added urlParams to AddIntegrationParams (used by IntegrationOrganizationLink for installation_id)

All existing call sites updated: AddIntegrationButton, PagerdutyAddServicesButton, and IntegrationOrganizationLink.

Refs VDY-69

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 13, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 13, 2026
…l time

Move useAddIntegration from views/settings/organizationIntegrations/ to
utils/integrations/ and change the API so startFlow() accepts all params
(provider, organization, onInstall, etc.) at call time instead of at
hook init. The hook now manages its own message listener via refs, so a
single instance can launch flows for any provider without a context
provider.

This enables multi-provider UIs like dropdowns to share one hook above
the dropdown, passing the selected provider to startFlow on click.

Extract computeCenteredWindow to utils/window/ and add urlParams to
AddIntegrationParams for the installation_id case.

Refs VDY-69
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.

1 participant