ref(integrations): Refactor useAddIntegration to accept params at call time#112876
Draft
ref(integrations): Refactor useAddIntegration to accept params at call time#112876
Conversation
…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
11128c2 to
aba129a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors
useAddIntegrationso thatstartFlow()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
messageevent listener via refs, eliminating the need for a context provider (PostMessageProvider) at call sites.Other changes:
views/settings/organizationIntegrations/toutils/integrations/computeCenteredWindowtoutils/window/urlParamstoAddIntegrationParams(used byIntegrationOrganizationLinkforinstallation_id)All existing call sites updated:
AddIntegrationButton,PagerdutyAddServicesButton, andIntegrationOrganizationLink.Refs VDY-69