pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

AA Bricks: If a mod contains more than one AA brick, the page editor breaks when different control room integrations are chosen on different bricks

Open BLoe opened this issue 1 year ago • 1 comments

image

Steps to Reproduce

  1. Create a new mod component in the page editor
  2. Add either one of the AA bricks (Run Bot, Run API Task)
  3. Select a local integration config that is a control room user/pass login (not OAuth2)
  4. Add another AA brick (either one again)
  5. In the second brick, select an OAuth2 control room integration config option

The error is being thrown from this spot in useSanitizedIntegrationConfigFormikAdapter()

Updating the auth config when the auth widget selection is changed is handled by setIntegrationAuthSelectionForField(), which calls produceExcludeUnusedDependencies() here.

Need to investigate why this isn't cleaning up the previous AA integration, when a new one is selected.

BLoe avatar Apr 02 '24 18:04 BLoe

when different control room integrations are chosen on different bricks

Do we know the root cause? Under the hood, I would think the following is happening:

  • If they're both in a single mod component: Page Editor would likely be implicitly creating 2 integration dependencies
  • If they're in different mod components: there would be a single integration dependency in each

When it comes to activation, having multiple configuration of the same integration type is NOT supported. IIRC, the user will be shown 1 configuration selector, and that will be applied to all the integration dependencies

So right now, this situation should only occur while the mod developer is in the process of switching over to a new integration configuration.

Perhaps we need a lint rule that warns if there are multiple configurations being used for the same integration definition?

Also, given that multiple configurations is not supported, we can have the Page Editor refuse to render certain fields if there are multiple configurations floating around

twschiller avatar Apr 03 '24 10:04 twschiller

Slack discussion clarifying specification: https://pixiebrix.slack.com/archives/C02RAMRDF0R/p1713488907786029

twschiller avatar Apr 19 '24 13:04 twschiller