Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): order connectable sources before "Coming soon" in catalog (#68488)

Tom Owers715e42eefe59
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
index c71312270052..b09192046be9 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
@@ -225,8 +225,20 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([
selectedCategory === ALL_SOURCES_CATEGORY
? base
: base.filter((item) => item.category === selectedCategory)
- // Keep fuzzy-search relevance order when searching; otherwise sort by name.
- return trimmed ? filtered : [...filtered].sort((a, b) => a.label.localeCompare(b.label))
+ // Keep fuzzy-search relevance order when searching. When browsing, lead with the
+ // sources the user can connect right now (alphabetically), then "Coming soon" ones,
+ // so the catalog doesn't open on a wall of unavailable tiles.
+ if (trimmed) {
+ return filtered
+ }
+ return [...filtered].sort((a, b) => {
+ const aComingSoon = a.status === 'coming_soon'
+ const bComingSoon = b.status === 'coming_soon'
+ if (aComingSoon !== bComingSoon) {
+ return aComingSoon ? 1 : -1
+ }
+ return a.label.localeCompare(b.label)
+ })
},
],
}),
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
index 04f3cefef7ab..dfe87af87933 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
@@ -12,6 +12,11 @@ const AVAILABLE_SOURCES: Record<string, SourceConfig> = {
caption: '',
fields: [],
} as unknown as SourceConfig,
+ // `Apple` sorts alphabetically first but is unreleased, so connectable-first ordering must
+ // still push it below the two available sources.
+ Zebra: { name: 'Zebra', label: 'Zebra', fields: [] } as unknown as SourceConfig,
+ Mango: { name: 'Mango', label: 'Mango', fields: [] } as unknown as SourceConfig,
+ Apple: { name: 'Apple', label: 'Apple', unreleasedSource: true, fields: [] } as unknown as SourceConfig,
}
describe('sourceCatalogLogic', () => {
@@ -49,6 +54,21 @@ describe('sourceCatalogLogic', () => {
expect(logic.values.sourceRequestText).toEqual(expectedText)
})
+ it('browses connectable sources before "Coming soon" ones', () => {
+ const logic = sourceCatalogLogic()
+ const items = logic.values.filteredItems
+
+ const firstComingSoon = items.findIndex((item) => item.status === 'coming_soon')
+ expect(firstComingSoon).toBeGreaterThan(-1)
+ // No connectable source may appear after the first "Coming soon" one.
+ expect(items.slice(firstComingSoon).every((item) => item.status === 'coming_soon')).toBe(true)
+
+ // `Apple` sorts first alphabetically but, being unreleased, must land after `Mango`/`Zebra`.
+ const names = items.map((item) => item.name)
+ expect(names.indexOf('Mango')).toBeLessThan(names.indexOf('Apple'))
+ expect(names.indexOf('Zebra')).toBeLessThan(names.indexOf('Apple'))
+ })
+
it('clears the request text when the modal is closed', () => {
const logic = sourceCatalogLogic()
logic.actions.setSearch('Podium')