diff --git a/src/facets/connect/atproto/index.inline.js b/src/facets/connect/atproto/index.inline.js index 48672d53..1b8e96e7 100644 --- a/src/facets/connect/atproto/index.inline.js +++ b/src/facets/connect/atproto/index.inline.js @@ -64,6 +64,24 @@ if (true) { await atprotoEl?.whenRestored(); } +// The output configurator can't find custom outputs (added by the +// output-bundle prelude) during its initial connectedCallback, so it +// re-loads the selected output via `loadSelected()` which is async. +// Wait for that to settle before rendering the UI, otherwise +// `selected()` is still null here and the "Use as userdata storage" +// button would show even though AT Protocol is already configured as +// the user's output. +if (outputOrchestrator.hasSelected() && !outputOrchestrator.selected()) { + await new Promise((resolve) => { + const stop = effect(() => { + if (outputOrchestrator.selected()) { + stop(); + resolve(undefined); + } + }); + }); +} + //////////////////////////////////////////// // UI //////////////////////////////////////////// diff --git a/src/facets/connect/s3/index.inline.js b/src/facets/connect/s3/index.inline.js index 2001c4a9..70eab451 100644 --- a/src/facets/connect/s3/index.inline.js +++ b/src/facets/connect/s3/index.inline.js @@ -134,6 +134,24 @@ async function handleScanClick() { } } +// The output configurator can't find custom outputs (added by the +// output-bundle prelude) during its initial connectedCallback, so it +// re-loads the selected output via `loadSelected()` which is async. +// Wait for that to settle before rendering the UI, otherwise +// `selected()` is still null here and the "Use as userdata storage" +// button would show even though S3 is already configured as the +// user's output. +if (outputOrchestrator.hasSelected() && !outputOrchestrator.selected()) { + await new Promise((resolve) => { + const stop = effect(() => { + if (outputOrchestrator.selected()) { + stop(); + resolve(undefined); + } + }); + }); +} + //////////////////////////////////////////// // UI ////////////////////////////////////////////