: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
chore(frontend): remove GoodbyeTabsModal migration (#61977)
Paul D'Ambra1dbca2b1d977
diff --git a/frontend/src/layout/GlobalModals.tsx b/frontend/src/layout/GlobalModals.tsxindex 0540c797a492..8d69a75161fe 100644--- a/frontend/src/layout/GlobalModals.tsx+++ b/frontend/src/layout/GlobalModals.tsx@@ -29,7 +29,6 @@ import type { globalModalsLogicType } from './GlobalModalsType'import { navigationLogic } from './navigation/navigationLogic'import { ConfigureHomeModal } from './scenes/ConfigureHomeModal'import { ConfigurePromotedProductModal } from './scenes/ConfigurePromotedProductModal'-import { GoodbyeTabsModal } from './scenes/GoodbyeTabsModal'export const globalModalsLogic = kea<globalModalsLogicType>([path(['layout', 'navigation', 'globalModalsLogic']),@@ -97,7 +96,6 @@ export function GlobalModals(): JSX.Element {isOpen={isConfigurePromotedProductModalOpen}onClose={hideConfigurePromotedProductModal}/>- <GoodbyeTabsModal /><MaybeWelcomeDialog /><ComposeTicketModal /></>diff --git a/frontend/src/layout/scenes/GoodbyeTabsModal.tsx b/frontend/src/layout/scenes/GoodbyeTabsModal.tsxdeleted file mode 100644index 72b149b4dc12..000000000000--- a/frontend/src/layout/scenes/GoodbyeTabsModal.tsx+++ /dev/null@@ -1,91 +0,0 @@-import { useActions, useValues } from 'kea'--import { IconCopy, IconPinFilled } from '@posthog/icons'-import { LemonButton, LemonModal } from '@posthog/lemon-ui'--import { Link } from 'lib/lemon-ui/Link'-import { copyToClipboard } from 'lib/utils/copyToClipboard'--import { goodbyeTabsModalLogic } from './goodbyeTabsModalLogic'--export function GoodbyeTabsModal(): JSX.Element {- const { isOpen, tabs, backendTabsLoading } = useValues(goodbyeTabsModalLogic)- const { dismiss } = useActions(goodbyeTabsModalLogic)-- return (- <LemonModal- isOpen={isOpen}- onClose={dismiss}- title="Goodbye tabs 😔"- description="Tabs were a fun experiment, but doing them well across an app this size is genuinely hard; your browser already nails it."- width="32rem"- footer={- <LemonButton type="primary" onClick={dismiss} data-attr="goodbye-tabs-dismiss">- Got it- </LemonButton>- }- >- <div className="deprecated-space-y-2">- <div className="text-sm deprecated-space-y-2">- <p className="m-0">- Users expected each tab to fully restore on switch: every input, every scroll position, every- bit of in-memory state. Solving that across an app this size is a huge undertaking, and it- competes with the ongoing work to reduce memory usage.- </p>- <p className="m-0">- Tabs also overrode normal browser behavior: right-click menus on links were replaced with a- custom contextual menu, and links with <code>target="_blank"</code> opened as scene tabs instead- of real browser tabs. Rather than ship a subpar version of something browsers already do- perfectly, we're handing it back to them.- </p>- <p className="m-0">- See the{' '}- <Link to="https://github.com/PostHog/posthog/issues/59856" target="_blank">- GitHub issue- </Link>{' '}- to learn more and share feedback on this decision.- </p>- </div>- <hr className="mt-2 mb-3 border-border" />- {tabs.length === 0 && backendTabsLoading ? (- <div className="text-muted">Loading your tabs…</div>- ) : tabs.length === 0 ? (- <div className="text-muted">No saved tabs to show.</div>- ) : (- <>- <p className="text-sm text-muted m-0">- Here are the tabs you had open. Pinned ones are listed first.- </p>- <ul className="m-0 pl-0 list-none deprecated-space-y-1">- {tabs.map((tab) => (- <li- key={tab.url}- className="flex items-center gap-2 border border-border rounded px-2 py-1.5 bg-surface-primary"- >- <Link to={tab.url} className="truncate flex-1 min-w-0" onClick={dismiss}>- {tab.title}- </Link>- {tab.pinned && (- <span className="flex items-center gap-1 text-xs uppercase tracking-wide text-tertiary shrink-0">- <IconPinFilled className="text-sm" />- Pinned- </span>- )}- <LemonButton- icon={<IconCopy />}- size="small"- onClick={() =>- void copyToClipboard(document.location.origin + tab.url, 'tab link')- }- tooltip="Copy link"- data-attr="goodbye-tabs-copy-link"- />- </li>- ))}- </ul>- </>- )}- </div>- </LemonModal>- )-}diff --git a/frontend/src/layout/scenes/goodbyeTabsModalLogic.ts b/frontend/src/layout/scenes/goodbyeTabsModalLogic.tsdeleted file mode 100644index ee8fe2d9cfc5..000000000000--- a/frontend/src/layout/scenes/goodbyeTabsModalLogic.ts+++ /dev/null@@ -1,219 +0,0 @@-import { actions, afterMount, kea, listeners, path, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import api from 'lib/api'-import { getCurrentTeamIdOrNone } from 'lib/utils/getAppContext'--import type { goodbyeTabsModalLogicType } from './goodbyeTabsModalLogicType'--const DISMISSED_KEY = 'posthog-tabs-farewell-dismissed'-const TAB_STATE_KEY = 'scene-tabs-state'-const PINNED_TAB_STATE_KEY = 'scene-tabs-pinned-state'--const getStorageKey = (key: string): string => {- const teamId = getCurrentTeamIdOrNone() ?? 'null'- return `${key}-${teamId}`-}--export interface FarewellTab {- url: string- title: string- pinned: boolean-}--interface RawTab {- pathname?: string- search?: string- hash?: string- title?: string- customTitle?: string | null- pinned?: boolean-}--interface BackendResponse {- tabs?: RawTab[]- homepage?: RawTab | null-}--const safeParse = <T>(raw: string | null): T | null => {- if (!raw) {- return null- }- try {- return JSON.parse(raw) as T- } catch {- return null- }-}--const toFarewellTab = (raw: RawTab, pinned: boolean): FarewellTab | null => {- const pathname = raw.pathname?.trim()- if (!pathname) {- return null- }- const url = `${pathname}${raw.search ?? ''}${raw.hash ?? ''}`- const title = (raw.customTitle || raw.title || pathname).trim()- return { url, title, pinned }-}--const collectLocal = (): FarewellTab[] => {- const session = safeParse<RawTab[]>(sessionStorage.getItem(getStorageKey(TAB_STATE_KEY))) ?? []- const pinnedRaw = safeParse<{ tabs?: RawTab[]; homepage?: RawTab | null } | RawTab[]>(- localStorage.getItem(getStorageKey(PINNED_TAB_STATE_KEY))- )-- let pinnedTabs: RawTab[] = []- let homepage: RawTab | null = null- if (Array.isArray(pinnedRaw)) {- pinnedTabs = pinnedRaw- } else if (pinnedRaw && typeof pinnedRaw === 'object') {- pinnedTabs = Array.isArray(pinnedRaw.tabs) ? pinnedRaw.tabs : []- homepage = pinnedRaw.homepage ?? null- }-- const out: FarewellTab[] = []- if (homepage) {- const f = toFarewellTab(homepage, true)- if (f) {- out.push(f)- }- }- for (const t of pinnedTabs) {- const f = toFarewellTab(t, true)- if (f) {- out.push(f)- }- }- for (const t of session) {- const f = toFarewellTab(t, !!t.pinned)- if (f) {- out.push(f)- }- }- return out-}--const dedupe = (tabs: FarewellTab[]): FarewellTab[] => {- const seen = new Set<string>()- const out: FarewellTab[] = []- for (const tab of tabs) {- if (seen.has(tab.url)) {- continue- }- seen.add(tab.url)- out.push(tab)- }- return out-}--const sortPinnedFirst = (tabs: FarewellTab[]): FarewellTab[] => {- const pinned = tabs.filter((t) => t.pinned)- const rest = tabs.filter((t) => !t.pinned)- return [...pinned, ...rest]-}--const backendResponseToTabs = (response: BackendResponse | null): FarewellTab[] => {- const out: FarewellTab[] = []- if (response?.homepage) {- const f = toFarewellTab(response.homepage, true)- if (f) {- out.push(f)- }- }- for (const t of response?.tabs ?? []) {- const f = toFarewellTab(t, true)- if (f) {- out.push(f)- }- }- return out-}--export const goodbyeTabsModalLogic = kea<goodbyeTabsModalLogicType>([- path(['layout', 'scenes', 'goodbyeTabsModalLogic']),- actions({- dismiss: true,- open: true,- }),- reducers({- dismissed: [- false,- { persist: true, storageKey: DISMISSED_KEY },- {- dismiss: () => true,- },- ],- isOpen: [- false,- {- open: () => true,- dismiss: () => false,- },- ],- }),- loaders({- backendTabs: [- [] as FarewellTab[],- {- loadBackendTabs: async () => {- try {- const response = await api.get<BackendResponse>('api/user_home_settings/@me/')- return backendResponseToTabs(response)- } catch {- return []- }- },- },- ],- }),- reducers({- localTabs: [- [] as FarewellTab[],- {- open: () => collectLocal(),- },- ],- }),- selectors({- tabs: [- (s) => [s.backendTabs, s.localTabs],- (backendTabs, localTabs): FarewellTab[] => sortPinnedFirst(dedupe([...backendTabs, ...localTabs])),- ],- }),- listeners(({ actions, values, cache }) => ({- dismiss: () => {- try {- localStorage.removeItem(getStorageKey(PINNED_TAB_STATE_KEY))- sessionStorage.removeItem(getStorageKey(TAB_STATE_KEY))- } catch {- // ignore- }- // Best-effort: clear server-side tabs so a fresh browser doesn't reopen the modal.- api.update('api/user_home_settings/@me/', { tabs: [], homepage: null }).catch(() => {- // ignore — modal will simply reopen on next browser; not worth surfacing- })- },- loadBackendTabsSuccess: ({ backendTabs }) => {- if (values.dismissed) {- return- }- const hasAnything = (cache.probedLocalTabs?.length ?? 0) > 0 || backendTabs.length > 0- if (hasAnything) {- actions.open()- } else {- // Nothing on this browser, nothing on the backend — never bother this user again.- actions.dismiss()- }- },- })),- afterMount(({ actions, values, cache }) => {- if (values.dismissed || cache.probed) {- return- }- cache.probed = true- // Snapshot local tabs so the loadBackendTabsSuccess listener can compare without- // having to also dispatch `open` just to populate the `localTabs` reducer.- cache.probedLocalTabs = collectLocal()- actions.loadBackendTabs()- }),-])