Skip to content

batches: fix publication state change alert banner

Administrator requested to merge kr/publication-states-banner into main

Created by: courier-new

Closes https://github.com/sourcegraph/sourcegraph/issues/34531.

In working async with Bolaji over slack to understand how the publication states get recalculated and how the banner was currently implemented, I realized it might just be easier to suggest an alternative approach that fixes the issue in code. Sorry to steal your ticket, Bolaji! 🙈

Before After
(banner appears any time the connection is requeried due to args changing) (banner only appears after requery when publication states change)

Most of the additions here are adding more/better comments about how this all works, since it's a bit peculiar and not straightforward (we keep the desired publication states as clientside state in React context, we only use them as "overrides" when querying the applyPreview connection or sending the applyBatchChange mutation, they only persist as long as you're on the page, we record timestamps to serve as the unique ID for each publication state modification event in order to show the banner... just to name a few 😅)

Test plan

Tested manually, as demonstrated above.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading