: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(navigation): show pending invite dot on the organization row (#109387)
Alex Liderebd79c1e92a6
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex e2d0323d5938..c0d7cbc8d724 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -124,18 +124,22 @@ snapshots:hash: v1.k794b7964.c18261f8a8a79a5e0902ddce51785b490a0989efa6795851640fc3652f196e80.YIgWf5MpUsQDOzGjlEXNDlIrEyg9GEBXU5HZn8A3GNAcomponents-account-assignment-filter--unassigned-only--light:hash: v1.k794b7964.4144ad0cfd0b53bd92cb7360bc27c693863338b5d393d69ddd900c542bc6f382.nk0C9Ks32zxldf1ffLBSBoB2xP_PQEKlyBbBOiiNP1c- components-account-project-switcher--no-pending-invite--dark:- hash: v1.k794b7964.ddbb5d27187cb1eb9341734e0b780c762cdfbc09aae81833c970369bd7ad4f32.3HNFMfb4Lflcg3uKD1-KNl09d3leMhmfuhR2WVLjLRE- components-account-project-switcher--no-pending-invite--light:- hash: v1.k794b7964.3f8d66ba04469cdf3e92d78483c58125e84531888eedde628469fde5e9e39a08.MhOzPyXhl7CeOLA5Em19cktkdgffO_BL7CojWkngtMQ+ components-account-org-switcher--no-pending-invite--dark:+ hash: v1.k794b7964.4388a2607493bd36d9bc8960e2db7720df10102c5e2675bd7b5043f32519aed2.vrUvJ1500oMMFj1Gdc8hWdOaDEMfJRLhHNevwJW_ShQ+ components-account-org-switcher--no-pending-invite--light:+ hash: v1.k794b7964.db6c1002f011be274c4d274319f422724d8ef4b9c56f7f2f0f29ce23268b1f9b.G8SN1NyxYZSFc-HXe2Jhp1J-2szjpnPFrcuzD_UDLxw+ components-account-org-switcher--with-pending-invite--dark:+ hash: v1.k794b7964.7e7973392507a753037f4f094c2610038922d5f7c24f53cb34e5eb382847f834.byvdYZq4qgwYwUrcp82ijCWn4wDtvKVHr5qjj0LN3Os+ components-account-org-switcher--with-pending-invite--light:+ hash: v1.k794b7964.a9b3da4207480a66210bba2a464ba36ec9088faba11571c76a3836bb8ec3224e.pynJGDeHW4VhZJ_1FDVwCNbJc7rqGK17NwwSmkRqg2I+ components-account-project-switcher--default--dark:+ hash: v1.k794b7964.ddbb5d27187cb1eb9341734e0b780c762cdfbc09aae81833c970369bd7ad4f32.3WklDJAVVmzyrW0Qg1WBXMN0EamqUuc7HcYoGYBjMec+ components-account-project-switcher--default--light:+ hash: v1.k794b7964.3f8d66ba04469cdf3e92d78483c58125e84531888eedde628469fde5e9e39a08.yksh25-a4q1Q-SmXQSq_IMBe7LNW0d2waKZw_tDj0_Acomponents-account-project-switcher--with-data-freshness--dark:hash: v1.k794b7964.33311041a0feedba12322f5c99b05b91db51c7f26793b837fce7c0666c5ef6f5.EPYhVoP42oDcDI9m3qloUEuvND0yjchkisUylND2Y-scomponents-account-project-switcher--with-data-freshness--light:hash: v1.k794b7964.825e1ea3745d1f526c46a4d7b365778ce2d3307933461503fca588f68916a3a9.6Bpu71WRfMaGy8N4X06ixaXTIYkj-4jg44eVXhgWkCw- components-account-project-switcher--with-pending-invite--dark:- hash: v1.k794b7964.b0c1c0b0b8d1a0c77cd873a1cc0b391924cd64ff7de46b1b4d309a50d98eca8a.ddWvJC0f1_fBpYhfDKtUrKeuZSrY5xR8ViHWVdiIfqk- components-account-project-switcher--with-pending-invite--light:- hash: v1.k794b7964.769ba5491bf515d4c18234cbb1b0965e4af8f190b5823914c8955194bb28d356.5QmxWM1jcZVZCAYm6oCJrI2XXnzoIHP19CyfFNvmiogcomponents-action-step-description--step-variants--dark:hash: v1.k794b7964.19f9bee33652dbf2425e6df03ae732ed625840c249efc00589e0a1c0457b45d4.rVZ9Ek86XyAHV2eXwI_PDDTdDVv0QnEup4nMHmBjRKkcomponents-action-step-description--step-variants--light:diff --git a/frontend/src/lib/components/Account/NewAccountMenu.tsx b/frontend/src/lib/components/Account/NewAccountMenu.tsxindex 35967e6efc8c..6a24df012a15 100644--- a/frontend/src/lib/components/Account/NewAccountMenu.tsx+++ b/frontend/src/lib/components/Account/NewAccountMenu.tsx@@ -134,7 +134,7 @@ export function NewAccountMenu({)}{hasPendingInvites && (<PendingInviteDot- className={isLayoutNavCollapsed ? 'absolute top-0.5 right-0.5' : 'mr-0.5'}+ className={isLayoutNavCollapsed ? 'absolute top-0 right-0' : 'ml-1 mr-0.5'}/>)}</ButtonPrimitive>@@ -197,7 +197,6 @@ export function NewAccountMenu({<span className="truncate font-semibold">{currentTeam ? projectNameWithoutFirstEmoji : 'Select project'}</span>- {hasPendingInvites && <PendingInviteDot className="mr-0.5" />}<MenuOpenIndicator intent="sub" className="ml-auto" /></ButtonPrimitive>}@@ -307,6 +306,7 @@ export function NewAccountMenu({? currentOrganization.name: 'Select organization'}</span>+ {hasPendingInvites && <PendingInviteDot className="mr-0.5" />}<MenuOpenIndicator intent="sub" className="ml-auto" /></ButtonPrimitive>}diff --git a/frontend/src/lib/components/Account/OrgSwitcher.stories.tsx b/frontend/src/lib/components/Account/OrgSwitcher.stories.tsxnew file mode 100644index 000000000000..1c30f51f069d--- /dev/null+++ b/frontend/src/lib/components/Account/OrgSwitcher.stories.tsx@@ -0,0 +1,58 @@+import { MOCK_DEFAULT_ORGANIZATION, MOCK_DEFAULT_TEAM, MOCK_DEFAULT_USER } from 'lib/api.mock'++import type { Meta, StoryObj } from '@storybook/react'++import { useStorybookMocks } from '~/mocks/browser'++import { OrgSwitcher } from './OrgSwitcher'++type StoryProps = { hasPendingInvite: boolean }++const PENDING_INVITE = {+ id: '018f0000-0000-0000-0000-000000000001',+ target_email: MOCK_DEFAULT_USER.email,+ organization_id: '018f0000-0000-0000-0000-00000000abcd',+ organization_name: 'Acme Corp',+ created_at: '2026-04-17T12:00:00Z',+}++const meta: Meta<(props: StoryProps) => JSX.Element> = {+ title: 'Components/Account/Org Switcher',+ parameters: {+ layout: 'centered',+ viewMode: 'story',+ },+ render: ({ hasPendingInvite }: StoryProps) => {+ useStorybookMocks({+ get: {+ '/api/users/@me/': () => [+ 200,+ {+ ...MOCK_DEFAULT_USER,+ pending_invites: hasPendingInvite ? [PENDING_INVITE] : [],+ },+ ],+ '/api/organizations/@current/': () => [200, MOCK_DEFAULT_ORGANIZATION],+ '/api/environments/@current/': () => [200, MOCK_DEFAULT_TEAM],+ '/api/projects/@current/': () => [200, MOCK_DEFAULT_TEAM],+ },+ })++ return (+ <div className="w-[340px] border border-primary rounded bg-surface-primary">+ <OrgSwitcher dialog />+ </div>+ )+ },+}+export default meta++type Story = StoryObj<(props: StoryProps) => JSX.Element>++export const NoPendingInvite: Story = {+ args: { hasPendingInvite: false },+}++export const WithPendingInvite: Story = {+ args: { hasPendingInvite: true },+}diff --git a/frontend/src/lib/components/Account/OrgSwitcher.tsx b/frontend/src/lib/components/Account/OrgSwitcher.tsxindex c8b0ad89177d..f7960f8d65bf 100644--- a/frontend/src/lib/components/Account/OrgSwitcher.tsx+++ b/frontend/src/lib/components/Account/OrgSwitcher.tsx@@ -7,12 +7,14 @@ import { IconCheck, IconPlusSmall, IconSearch, IconX } from '@posthog/icons'import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'import { upgradeModalLogic } from 'lib/components/UpgradeModal/upgradeModalLogic'import { IconBlank } from 'lib/lemon-ui/icons'+import { LemonTag } from 'lib/lemon-ui/LemonTag/LemonTag'import { UploadedLogo } from 'lib/lemon-ui/UploadedLogo'import { preflightLogic } from 'lib/logic/preflightLogic'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'import { MenuSeparator } from 'lib/ui/Menus/Menus'import { cn } from 'lib/utils/css-classes'import { organizationLogic } from 'scenes/organizationLogic'+import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'import { globalModalsLogic } from '~/layout/globalModalsLogic'@@ -21,6 +23,7 @@ import { AvailableFeature, OrganizationBasicType } from '~/types'import { ScrollableShadows } from '../ScrollableShadows/ScrollableShadows'import { newAccountMenuLogic } from './newAccountMenuLogic'+import { pendingInvitesLogic, PendingInviteForCurrentUser } from './pendingInvitesLogic'interface OrgListItem {type: 'org'@@ -31,13 +34,19 @@ interface OrgListItem {disabledReason?: string}+interface PendingInviteListItem {+ type: 'pending-invite'+ id: string+ invite: PendingInviteForCurrentUser+}+interface CreateOrgItem {type: 'create'id: 'create-new-org'label: string}-type ListItem = OrgListItem | CreateOrgItem+type ListItem = OrgListItem | PendingInviteListItem | CreateOrgItemexport function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Element {const { preflight } = useValues(preflightLogic)@@ -45,6 +54,7 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemenconst { showCreateOrganizationModal } = useActions(globalModalsLogic)const { currentOrganization } = useValues(organizationLogic)const { otherOrganizations } = useValues(userLogic)+ const { pendingInvites } = useValues(pendingInvitesLogic)const { updateCurrentOrganization } = useActions(userLogic)const { closeOrgSwitcher, setAccountMenuOpen } = useActions(newAccountMenuLogic)const [searchValue, setSearchValue] = useState('')@@ -77,6 +87,16 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemenreturn items}, [currentOrganization, otherOrganizations])+ const allPendingInviteItems: PendingInviteListItem[] = useMemo(+ () =>+ pendingInvites.map((invite) => ({+ type: 'pending-invite' as const,+ id: invite.id,+ invite,+ })),+ [pendingInvites]+ )+const filteredItems = useMemo(() => {const searchLower = searchValue.trim().toLowerCase()@@ -85,6 +105,10 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemen? allOrgItems.filter((item) => item.org.name.toLowerCase().includes(searchLower)): allOrgItems+ const filteredInvites = searchLower+ ? allPendingInviteItems.filter((item) => item.invite.organization_name.toLowerCase().includes(searchLower))+ : allPendingInviteItems+// Create the "create" item - show different label based on searchconst createItem: CreateOrgItem = {type: 'create',@@ -94,13 +118,16 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemen// label: searchValue.trim() ? `Create '${searchValue.trim()}'` : 'New organization',}- return [...filteredOrgs, createItem] as ListItem[]- }, [allOrgItems, searchValue])+ return [...filteredOrgs, ...filteredInvites, createItem] as ListItem[]+ }, [allOrgItems, allPendingInviteItems, searchValue])const currentOrgItem = filteredItems.find((o): o is OrgListItem => o.type === 'org' && o.isCurrent)const otherOrgItems = filteredItems.filter((o): o is OrgListItem => o.type === 'org' && !o.isCurrent).sort((a, b) => a.org.name.localeCompare(b.org.name))+ const pendingInviteItems = filteredItems+ .filter((o): o is PendingInviteListItem => o.type === 'pending-invite')+ .sort((a, b) => a.invite.organization_name.localeCompare(b.invite.organization_name))const createItem = filteredItems.find((o): o is CreateOrgItem => o.type === 'create')const handleItemClick = useCallback(@@ -115,6 +142,9 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemen{ guardOnCloud: false })closeOrgSwitcher()+ } else if (item.type === 'pending-invite') {+ closeOrgSwitcher()+ window.location.href = urls.inviteSignup(item.invite.id)} else if (!item.isCurrent && !item.isDisabled) {closeOrgSwitcher()updateCurrentOrganization(item.org.id)@@ -136,6 +166,9 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemenif (item.type === 'create') {return item.label}+ if (item.type === 'pending-invite') {+ return item.invite.organization_name+ }return item.org.name}, [])@@ -271,6 +304,41 @@ export function OrgSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elemen</Combobox.Group>)}+ {/* Pending Invitations */}+ {pendingInviteItems.length > 0 && (+ <Combobox.Group items={pendingInviteItems}>+ <Combobox.Collection>+ {(item: PendingInviteListItem) => (+ <Combobox.Item+ key={item.id}+ value={item}+ onClick={() => handleItemClick(item)}+ render={(props) => (+ <ButtonPrimitive+ {...props}+ menuItem+ fullWidth+ tooltip={`Accept pending invitation to ${item.invite.organization_name}`}+ tooltipPlacement="right"+ >+ <IconBlank />+ <UploadedLogo+ size="xsmall"+ name={item.invite.organization_name}+ entityId={item.invite.organization_id}+ />+ <span className="truncate">{item.invite.organization_name}</span>+ <div className="ml-auto">+ <LemonTag>pending invite</LemonTag>+ </div>+ </ButtonPrimitive>+ )}+ />+ )}+ </Combobox.Collection>+ </Combobox.Group>+ )}+<MenuSeparator />{/* Create New Organization */}diff --git a/frontend/src/lib/components/Account/ProjectMenu.tsx b/frontend/src/lib/components/Account/ProjectMenu.tsxindex 4e31700d28da..e2341f7df340 100644--- a/frontend/src/lib/components/Account/ProjectMenu.tsx+++ b/frontend/src/lib/components/Account/ProjectMenu.tsx@@ -2,6 +2,7 @@ import { useValues } from 'kea'import { LemonSnack } from '@posthog/lemon-ui'+import { Tooltip } from 'lib/lemon-ui/Tooltip'import { ButtonPrimitive, ButtonPrimitiveProps } from 'lib/ui/Button/ButtonPrimitives'import { MenuOpenIndicator } from 'lib/ui/Menus/Menus'import {@@ -27,14 +28,24 @@ export function ProjectName({ team, className }: { team: TeamBasicType; classNam}export function PendingInviteDot({ className }: { className?: string }): JSX.Element {+ const { pendingInvites } = useValues(pendingInvitesLogic)+ const organizationNames = pendingInvites.map((invite) => invite.organization_name)+ const title =+ organizationNames.length === 1+ ? `You have a pending invite to join ${organizationNames[0]}.`+ : `You have pending invites to join ${organizationNames.length} organizations.`+return (- <span- aria-label="Pending invitation"- className={cn('relative flex items-center justify-center size-1.5 shrink-0', className)}- >- <span className="absolute inset-0 rounded-full bg-accent opacity-60 animate-ping" />- <span className="relative size-1.5 rounded-full bg-accent" />- </span>+ <Tooltip title={title} placement="right">+ <span+ aria-label="Pending invite"+ className={cn('relative flex items-center justify-center size-3 shrink-0', className)}+ >+ {/* The ping halo scales to twice the dot, so the box is twice the dot to keep it off the neighbors */}+ <span className="absolute size-1.5 rounded-full bg-accent opacity-60 animate-ping" />+ <span className="relative size-1.5 rounded-full bg-accent" />+ </span>+ </Tooltip>)}@@ -61,7 +72,6 @@ export function ProjectMenu({iconOnly ? 'min-w-auto' : '',buttonProps.className)}- tooltip={hasPendingInvites ? 'You have a pending invitation' : buttonProps.tooltip}>{iconOnly ? (<div className="Lettermark bg-[var(--color-bg-fill-button-tertiary-active)] w-5 h-5 dark:text-tertiary">@@ -70,9 +80,7 @@ export function ProjectMenu({) : (<span className="truncate">{currentTeam.name ?? 'Project'}</span>)}- {hasPendingInvites && (- <PendingInviteDot className={iconOnly ? 'absolute top-0.5 right-0.5' : 'ml-1'} />- )}+ {hasPendingInvites && <PendingInviteDot className={iconOnly ? 'absolute top-0 right-0' : 'ml-1'} />}{!iconOnly && <MenuOpenIndicator className="ml-auto" />}</ButtonPrimitive></PopoverPrimitiveTrigger>diff --git a/frontend/src/lib/components/Account/ProjectSwitcher.stories.tsx b/frontend/src/lib/components/Account/ProjectSwitcher.stories.tsxindex de82ae88c739..20aaf1a87041 100644--- a/frontend/src/lib/components/Account/ProjectSwitcher.stories.tsx+++ b/frontend/src/lib/components/Account/ProjectSwitcher.stories.tsx@@ -8,15 +8,7 @@ import { useStorybookMocks } from '~/mocks/browser'import { ProjectSwitcher } from './ProjectSwitcher'-type StoryProps = { hasPendingInvite: boolean; hasDataFreshness?: boolean }--const PENDING_INVITE = {- id: '018f0000-0000-0000-0000-000000000001',- target_email: MOCK_DEFAULT_USER.email,- organization_id: '018f0000-0000-0000-0000-00000000abcd',- organization_name: 'Acme Corp',- created_at: '2026-04-17T12:00:00Z',-}+type StoryProps = { hasDataFreshness?: boolean }// The case this feature exists for: a pile of similarly named leftovers around one product,// where only one is real and the names alone can't tell you which.@@ -79,7 +71,7 @@ const meta: Meta<(props: StoryProps) => JSX.Element> = {layout: 'centered',viewMode: 'story',},- render: ({ hasPendingInvite, hasDataFreshness }: StoryProps) => {+ render: ({ hasDataFreshness }: StoryProps) => {const organization = hasDataFreshness? { ...MOCK_DEFAULT_ORGANIZATION, teams: [MOCK_DEFAULT_TEAM, ...FRESHNESS_TEAMS] }: MOCK_DEFAULT_ORGANIZATION@@ -91,7 +83,6 @@ const meta: Meta<(props: StoryProps) => JSX.Element> = {{...MOCK_DEFAULT_USER,organization,- pending_invites: hasPendingInvite ? [PENDING_INVITE] : [],},],'/api/organizations/@current/': () => [200, organization],@@ -115,14 +106,10 @@ export default metatype Story = StoryObj<(props: StoryProps) => JSX.Element>-export const NoPendingInvite: Story = {- args: { hasPendingInvite: false },-}--export const WithPendingInvite: Story = {- args: { hasPendingInvite: true },+export const Default: Story = {+ args: { hasDataFreshness: false },}export const WithDataFreshness: Story = {- args: { hasPendingInvite: false, hasDataFreshness: true },+ args: { hasDataFreshness: true },}diff --git a/frontend/src/lib/components/Account/ProjectSwitcher.tsx b/frontend/src/lib/components/Account/ProjectSwitcher.tsxindex ce88fb62800d..1b61bebbac88 100644--- a/frontend/src/lib/components/Account/ProjectSwitcher.tsx+++ b/frontend/src/lib/components/Account/ProjectSwitcher.tsx@@ -2,7 +2,7 @@ import { Combobox } from '@base-ui/react/combobox'import { useActions, useValues } from 'kea'import { useCallback, useMemo, useRef, useState } from 'react'-import { IconCheck, IconLetter, IconPlusSmall, IconSearch, IconX } from '@posthog/icons'+import { IconCheck, IconPlusSmall, IconSearch, IconX } from '@posthog/icons'import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'import { upgradeModalLogic } from 'lib/components/UpgradeModal/upgradeModalLogic'@@ -14,14 +14,12 @@ import { cn } from 'lib/utils/css-classes'import { getProjectSwitchTargetUrl } from 'lib/utils/kea-router'import { organizationLogic } from 'scenes/organizationLogic'import { isAuthenticatedTeam, teamLogic } from 'scenes/teamLogic'-import { urls } from 'scenes/urls'import { globalModalsLogic } from '~/layout/globalModalsLogic'import { AvailableFeature, TeamBasicType } from '~/types'import { ScrollableShadows } from '../ScrollableShadows/ScrollableShadows'import { newAccountMenuLogic } from './newAccountMenuLogic'-import { pendingInvitesLogic, PendingInviteForCurrentUser } from './pendingInvitesLogic'import { ProjectFreshnessIndicator } from './ProjectFreshnessIndicator'import { ProjectName } from './ProjectMenu'@@ -32,19 +30,13 @@ interface ProjectListItem {isCurrent: boolean}-interface PendingInviteListItem {- type: 'pending-invite'- id: string- invite: PendingInviteForCurrentUser-}-interface CreateProjectItem {type: 'create'id: 'create-new-project'label: string}-type ListItem = ProjectListItem | PendingInviteListItem | CreateProjectItem+type ListItem = ProjectListItem | CreateProjectItemexport function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Element | null {const { preflight } = useValues(preflightLogic)@@ -52,7 +44,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elconst { showCreateProjectModal } = useActions(globalModalsLogic)const { currentTeam } = useValues(teamLogic)const { currentOrganization, projectCreationForbiddenReason } = useValues(organizationLogic)- const { pendingInvites } = useValues(pendingInvitesLogic)const { closeProjectSwitcher, setAccountMenuOpen } = useActions(newAccountMenuLogic)const [searchValue, setSearchValue] = useState('')const inputRef = useRef<HTMLInputElement>(null!)@@ -74,16 +65,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elreturn items}, [currentOrganization?.teams, currentTeam?.id])- const allPendingInviteItems: PendingInviteListItem[] = useMemo(- () =>- pendingInvites.map((invite) => ({- type: 'pending-invite' as const,- id: invite.id,- invite,- })),- [pendingInvites]- )-const filteredItems = useMemo(() => {const searchLower = searchValue.trim().toLowerCase()@@ -92,10 +73,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.El? allProjectItems.filter((item) => item.team.name.toLowerCase().includes(searchLower)): allProjectItems- const filteredInvites = searchLower- ? allPendingInviteItems.filter((item) => item.invite.organization_name.toLowerCase().includes(searchLower))- : allPendingInviteItems-// Create the "create" item - show different label based on searchconst createItem: CreateProjectItem = {type: 'create',@@ -105,16 +82,13 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.El// label: searchValue.trim() ? `Create '${searchValue.trim()}'` : 'New project',}- return [...filteredProjects, ...filteredInvites, createItem] as ListItem[]- }, [allProjectItems, allPendingInviteItems, searchValue])+ return [...filteredProjects, createItem] as ListItem[]+ }, [allProjectItems, searchValue])const currentProject = filteredItems.find((p): p is ProjectListItem => p.type === 'project' && p.isCurrent)const otherProjects = filteredItems.filter((p): p is ProjectListItem => p.type === 'project' && !p.isCurrent).sort((a, b) => a.team.name.localeCompare(b.team.name))- const pendingInviteItems = filteredItems- .filter((p): p is PendingInviteListItem => p.type === 'pending-invite')- .sort((a, b) => a.invite.organization_name.localeCompare(b.invite.organization_name))const createItem = filteredItems.find((p): p is CreateProjectItem => p.type === 'create')const canCreateProject = preflight?.can_create_org !== false && !projectCreationForbiddenReason@@ -138,9 +112,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.El})closeProjectSwitcher()- } else if (item.type === 'pending-invite') {- closeProjectSwitcher()- window.location.href = urls.inviteSignup(item.invite.id)} else if (!item.isCurrent) {const targetUrl = getProjectSwitchTargetUrl(location.pathname,@@ -170,9 +141,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.Elif (item.type === 'create') {return item.label}- if (item.type === 'pending-invite') {- return item.invite.organization_name- }return item.team.name}, [])@@ -294,39 +262,6 @@ export function ProjectSwitcher({ dialog = true }: { dialog?: boolean }): JSX.El</Combobox.Group>)}- {/* Pending Invitations */}- {pendingInviteItems.length > 0 && (- <Combobox.Group items={pendingInviteItems}>- <Combobox.Collection>- {(item: PendingInviteListItem) => (- <Combobox.Item- key={item.id}- value={item}- onClick={() => handleItemClick(item)}- render={(props) => (- <ButtonPrimitive- {...props}- menuItem- className="flex-1"- tabIndex={-1}- tooltip={`Accept pending invitation to ${item.invite.organization_name}`}- tooltipPlacement="right"- >- <IconLetter className="text-warning" />- <span className="truncate flex-1">- {item.invite.organization_name}- </span>- <span className="text-xxs text-tertiary shrink-0 ml-1">- Pending invite- </span>- </ButtonPrimitive>- )}- />- )}- </Combobox.Collection>- </Combobox.Group>- )}-<MenuSeparator />{/* Create New Project */}diff --git a/frontend/src/scenes/project/PendingDeletion.tsx b/frontend/src/scenes/project/PendingDeletion.tsxindex cd181c897014..e47adc9ed5b3 100644--- a/frontend/src/scenes/project/PendingDeletion.tsx+++ b/frontend/src/scenes/project/PendingDeletion.tsx@@ -5,6 +5,7 @@ import { LemonButton, LemonCard } from '@posthog/lemon-ui'import { newAccountMenuLogic } from 'lib/components/Account/newAccountMenuLogic'import { OrgSwitcher } from 'lib/components/Account/OrgSwitcher'+import { pendingInvitesLogic } from 'lib/components/Account/pendingInvitesLogic'import { ProjectSwitcher } from 'lib/components/Account/ProjectSwitcher'import { HogWelder } from 'lib/components/hedgehogs'import { dayjs } from 'lib/dayjs'@@ -26,7 +27,9 @@ export function ProjectPendingDeletion(): JSX.Element {const { isProjectSwitcherOpen, isOrgSwitcherOpen } = useValues(newAccountMenuLogic)const { openProjectSwitcher, closeProjectSwitcher, openOrgSwitcher, closeOrgSwitcher } =useActions(newAccountMenuLogic)- const hasOtherOrgs = otherOrganizations.length > 0+ const { pendingInvites } = useValues(pendingInvitesLogic)+ // Pending invites are accepted from the organization switcher, so show it for them too+ const showOrgSwitcher = otherOrganizations.length > 0 || pendingInvites.length > 0return (<div className="max-w-[600px] mx-auto px-2 py-8">@@ -73,7 +76,7 @@ export function ProjectPendingDeletion(): JSX.Element {Switch project</LemonButton></Popover>- {hasOtherOrgs && (+ {showOrgSwitcher && (<Popovervisible={isOrgSwitcherOpen}onClickOutside={closeOrgSwitcher}