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(navigation): hide starred products while their flag is off (#110836)

posthog[bot]79184f85f81b
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
index 82b475003f9f..5c78138be1e2 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.test.ts
@@ -6,6 +6,7 @@ import { sceneFileLogic } from 'lib/components/Scenes/sceneFileLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { urls } from 'scenes/urls'
import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'
import { useMocks } from '~/mocks/jest'
@@ -99,6 +100,19 @@ describe('projectTreeDataLogic', () => {
}
)
+ it.each([false, true])('shows a starred flagged product only while its flag is on (%s)', (flagOn) => {
+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.WAREHOUSE_MULTI_DESTINATION]: flagOn })
+ logic.actions.loadShortcutsSuccess([
+ { id: 'star-elt', path: 'ELT', type: 'product', href: urls.etlOverview() },
+ { id: 'star-sql', path: 'SQL editor', type: 'product', href: urls.sqlEditor() },
+ ])
+
+ expect(logic.values.getShortcutTreeItems('', false).map((item) => item.name)).toEqual(
+ flagOn ? ['ELT', 'SQL editor'] : ['SQL editor']
+ )
+ expect(logic.values.shortcutData).toHaveLength(2)
+ })
+
it('reloads starred folders after a move, preserving custom labels and untouched environments', async () => {
await expectLogic(logic).toFinishAllListeners()
logic.actions.loadShortcutsSuccess([
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
index 23a5e3f01c4b..a55933222ecb 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeDataLogic.tsx
@@ -1589,11 +1589,23 @@ export const projectTreeDataLogic = kea<projectTreeDataLogicType>([
users: Record<string, UserBasicType>,
featureFlags: import('lib/logic/featureFlagLogic').FeatureFlagsSet
): ((searchTerm: string, onlyFolders: boolean) => TreeDataItem[]) => {
+ // Hide a starred product while its flag is off, but keep the star so it comes back with the flag.
+ const productIsEnabled = (product: FileSystemImport): boolean =>
+ !product.flag || !!(featureFlags as Record<string, boolean>)[product.flag]
+ const products = getDefaultTreeProducts()
+ const enabledProductHrefs = new Set(products.filter(productIsEnabled).map((product) => product.href))
+ const hiddenProductHrefs = new Set(
+ products
+ .filter((product) => product.href && !enabledProductHrefs.has(product.href))
+ .map((product) => product.href)
+ )
return function getStaticItems(searchTerm: string, onlyFolders: boolean): TreeDataItem[] {
const newShortcutData = []
for (const shortcut of shortcutData.filter(
- // only remove shortcuts that are group view shortcuts when CRM iteration one is enabled
- (shortcut) => !(featureFlags[FEATURE_FLAGS.CRM_ITERATION_ONE] && isGroupViewShortcut(shortcut))
+ (shortcut) =>
+ // only remove shortcuts that are group view shortcuts when CRM iteration one is enabled
+ !(featureFlags[FEATURE_FLAGS.CRM_ITERATION_ONE] && isGroupViewShortcut(shortcut)) &&
+ !(shortcut.type !== 'folder' && !shortcut.ref && hiddenProductHrefs.has(shortcut.href))
)) {
const shortcutTreeItem = convertFileSystemEntryToTreeDataItem({
root: 'shortcuts://',