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(frontend): restore new-tab semantic after posthog tabs removal (#60597)

Adam Leithcf5f320e9067
diff --git a/frontend/src/lib/components/Search/Search.tsx b/frontend/src/lib/components/Search/Search.tsx
index 149608a47c34..faffca50d450 100644
--- a/frontend/src/lib/components/Search/Search.tsx
+++ b/frontend/src/lib/components/Search/Search.tsx
@@ -26,7 +26,6 @@ import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { ContextMenu, ContextMenuContent, ContextMenuGroup, ContextMenuTrigger } from 'lib/ui/ContextMenu/ContextMenu'
import { Label } from 'lib/ui/Label/Label'
import { WrappingLoadingSkeleton } from 'lib/ui/WrappingLoadingSkeleton/WrappingLoadingSkeleton'
-import { getRelativeNextPath } from 'lib/utils'
import { cn } from 'lib/utils/css-classes'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -648,8 +647,7 @@ export interface SearchInputProps {
}
function SearchInput({ autoFocus, className }: SearchInputProps): JSX.Element {
- const { searchValue, setSearchValue, isActive, inputRef, highlightedItemRef, showAskAiLink, onAskAiClick } =
- useSearchContext()
+ const { searchValue, setSearchValue, isActive, inputRef, showAskAiLink, onAskAiClick } = useSearchContext()
const { text: placeholderText, isVisible: placeholderVisible } = useRotatingPlaceholder(isActive && !searchValue)
@@ -662,24 +660,13 @@ function SearchInput({ autoFocus, className }: SearchInputProps): JSX.Element {
const handleInputKeyDown = useCallback(
(e: React.KeyboardEvent) => {
- if (e.key === 'Enter' && e.shiftKey) {
- e.preventDefault()
- e.stopPropagation()
- const item = highlightedItemRef.current
- if (item?.href) {
- const safePath = getRelativeNextPath(item.href, window.location)
- if (safePath) {
- window.open(safePath, '_blank', 'noopener,noreferrer')
- }
- }
- }
if (e.key === 'Tab' && showAskAiLink && searchValue.trim()) {
e.preventDefault()
onAskAiClick?.()
router.actions.push(urls.ai(undefined, searchValue.trim()))
}
},
- [highlightedItemRef, showAskAiLink, searchValue, onAskAiClick]
+ [showAskAiLink, searchValue, onAskAiClick]
)
useEffect(() => {
@@ -1003,9 +990,6 @@ function SearchFooter({ children }: SearchFooterProps): JSX.Element {
<span>
<KeyboardShortcut enter /> to activate
</span>
- <span>
- <KeyboardShortcut shift enter /> to open in new tab
- </span>
{searchValue.trim() && (
<span>
<KeyboardShortcut tab /> to ask AI
diff --git a/frontend/src/lib/utils/newInternalTab.tsx b/frontend/src/lib/utils/newInternalTab.tsx
index 03fd77a0e619..b0d550aaa59f 100644
--- a/frontend/src/lib/utils/newInternalTab.tsx
+++ b/frontend/src/lib/utils/newInternalTab.tsx
@@ -1,14 +1,34 @@
-import { router } from 'kea-router'
+import { addProjectIdIfMissing } from 'lib/utils/router-utils'
-// Retained as a no-op dispatch type for any legacy listeners.
export const NEW_INTERNAL_TAB = 'NEW_INTERNAL_TAB'
/**
- * PostHog tabs were removed — this helper used to open a new internal tab,
- * but now simply navigates the current page to the given path.
+ * Open a path in a new browser tab. Preserves project scoping for relative URLs.
+ *
+ * Dispatches a synthetic cmd/ctrl-click on an anchor — browsers treat modifier-clicks
+ * on `<a target="_blank">` as "open in new tab" regardless of the user's `window.open`
+ * preference, while plain `window.open` and bare `.click()` can route to a new window.
*/
export function newInternalTab(path?: string, _source: 'internal_link' | 'unknown' = 'internal_link'): void {
- if (path) {
- router.actions.push(path)
+ if (!path) {
+ return
}
+ const isExternal = /^(https?:|mailto:)/.test(path)
+ const href = isExternal ? path : addProjectIdIfMissing(path)
+
+ const anchor = document.createElement('a')
+ anchor.href = href
+ anchor.target = '_blank'
+ anchor.rel = 'noopener noreferrer'
+
+ const isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform)
+ anchor.dispatchEvent(
+ new MouseEvent('click', {
+ bubbles: true,
+ cancelable: true,
+ view: window,
+ ctrlKey: !isMac,
+ metaKey: isMac,
+ })
+ )
}
diff --git a/frontend/src/scenes/dashboard/DashboardSceneMenuBar.tsx b/frontend/src/scenes/dashboard/DashboardSceneMenuBar.tsx
index c06362ec030f..879d6d14d1b4 100644
--- a/frontend/src/scenes/dashboard/DashboardSceneMenuBar.tsx
+++ b/frontend/src/scenes/dashboard/DashboardSceneMenuBar.tsx
@@ -27,10 +27,10 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { slugify } from 'lib/utils'
import { getAccessControlDisabledReason, userHasAccess } from 'lib/utils/accessControlUtils'
import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { deleteDashboardLogic } from 'scenes/dashboard/deleteDashboardLogic'
import { duplicateDashboardLogic } from 'scenes/dashboard/duplicateDashboardLogic'
import { interProjectCopyLogic } from 'scenes/resource-transfer/interProjectCopyLogic'
-import { sceneLogic } from 'scenes/sceneLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -81,7 +81,6 @@ function DashboardSceneMenuBarInner(): JSX.Element | null {
const { startExport } = useActions(exportsLogic)
const { createNotebookFromDashboard } = useActions(notebooksModel)
const { showInsightColorsModal } = useActions(dashboardInsightColorsModalLogic)
- const { newTab } = useActions(sceneLogic)
const { setScenePanelOpen } = useActions(sceneLayoutLogic)
const { showDuplicateDashboardModal } = useActions(duplicateDashboardLogic)
const { showDeleteDashboardModal } = useActions(deleteDashboardLogic)
@@ -185,7 +184,7 @@ function DashboardSceneMenuBarInner(): JSX.Element | null {
effectiveEditBarFilters,
tile?.filters_overrides
)
- newTab(url)
+ newInternalTab(url)
})
setScenePanelOpen(false)
}}
diff --git a/frontend/src/scenes/dashboard/DashboardScenePanel.tsx b/frontend/src/scenes/dashboard/DashboardScenePanel.tsx
index 507ee8f290ca..ea0272515f5d 100644
--- a/frontend/src/scenes/dashboard/DashboardScenePanel.tsx
+++ b/frontend/src/scenes/dashboard/DashboardScenePanel.tsx
@@ -17,10 +17,10 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { slugify } from 'lib/utils'
import { DashboardEventSource } from 'lib/utils/eventUsageLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { deleteDashboardLogic } from 'scenes/dashboard/deleteDashboardLogic'
import { duplicateDashboardLogic } from 'scenes/dashboard/duplicateDashboardLogic'
import { interProjectCopyLogic } from 'scenes/resource-transfer/interProjectCopyLogic'
-import { sceneLogic } from 'scenes/sceneLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -58,7 +58,6 @@ export function DashboardScenePanel(): JSX.Element | null {
const { setDashboardMode, updateDashboardTags, togglePinned, setTerraformModalOpen } = useActions(dashboardLogic)
const { createNotebookFromDashboard } = useActions(notebooksModel)
const { showInsightColorsModal } = useActions(dashboardInsightColorsModalLogic)
- const { newTab } = useActions(sceneLogic)
const { setScenePanelOpen } = useActions(sceneLayoutLogic)
const { showDuplicateDashboardModal } = useActions(duplicateDashboardLogic)
const { showDeleteDashboardModal } = useActions(deleteDashboardLogic)
@@ -197,7 +196,7 @@ export function DashboardScenePanel(): JSX.Element | null {
effectiveEditBarFilters,
tile?.filters_overrides
)
- newTab(url)
+ newInternalTab(url)
})
setScenePanelOpen(false)
}}
diff --git a/frontend/src/scenes/data-warehouse/editor/sidebar/QueryDatabase.tsx b/frontend/src/scenes/data-warehouse/editor/sidebar/QueryDatabase.tsx
index f8024305c527..9aaad348e7f7 100644
--- a/frontend/src/scenes/data-warehouse/editor/sidebar/QueryDatabase.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/sidebar/QueryDatabase.tsx
@@ -22,6 +22,7 @@ import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonInput } from 'lib/lemon-ui/LemonInput'
import { LemonTree, LemonTreeRef, TreeDataItem } from 'lib/lemon-ui/LemonTree/LemonTree'
import { TreeNodeDisplayIcon } from 'lib/lemon-ui/LemonTree/LemonTreeUtils'
+import { Link } from 'lib/lemon-ui/Link'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { DropdownMenuGroup, DropdownMenuItem } from 'lib/ui/DropdownMenu/DropdownMenu'
import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'
@@ -688,51 +689,35 @@ export const QueryDatabase = ({
<div className="flex gap-px">
{!isEmbeddedMode && item.record.type !== 'endpoint' ? (
<>
- <DropdownMenuItem
- asChild
- onClick={(e) => {
- e.stopPropagation()
- if (editViewAccessDisabledReason) {
- return
- }
- openItemEditor(item)
- }}
- >
- <ButtonPrimitive
- menuItem
- className="flex-1 rounded-r-none"
- disabledReasons={
- editViewAccessDisabledReason
- ? { [editViewAccessDisabledReason]: true }
- : {}
- }
+ <DropdownMenuItem asChild>
+ <Link
+ to={urls.sqlEditor({ view_id: item.record.view?.id })}
+ onClick={(e) => e.stopPropagation()}
+ disabledReason={editViewAccessDisabledReason}
+ buttonProps={{
+ menuItem: true,
+ className: 'flex-1 rounded-r-none',
+ }}
>
{editLabel}
- </ButtonPrimitive>
+ </Link>
</DropdownMenuItem>
- <DropdownMenuItem
- asChild
- onClick={(e) => {
- e.stopPropagation()
- if (editViewAccessDisabledReason) {
- return
- }
- openItemEditor(item, true)
- }}
- >
- <ButtonPrimitive
- menuItem
- className="px-2 rounded-l-none"
- iconOnly
+ <DropdownMenuItem asChild>
+ <Link
+ to={urls.sqlEditor({ view_id: item.record.view?.id })}
+ target="_blank"
+ targetBlankIcon={false}
+ onClick={(e) => e.stopPropagation()}
+ disabledReason={editViewAccessDisabledReason}
tooltip={editLabel}
- disabledReasons={
- editViewAccessDisabledReason
- ? { [editViewAccessDisabledReason]: true }
- : {}
- }
+ buttonProps={{
+ menuItem: true,
+ iconOnly: true,
+ className: 'px-2 rounded-l-none',
+ }}
>
<IconExternal />
- </ButtonPrimitive>
+ </Link>
</DropdownMenuItem>
</>
) : (
diff --git a/frontend/src/scenes/data-warehouse/editor/sidebar/queryDatabaseLogic.tsx b/frontend/src/scenes/data-warehouse/editor/sidebar/queryDatabaseLogic.tsx
index b5adfa245b81..3a8cb7f36186 100644
--- a/frontend/src/scenes/data-warehouse/editor/sidebar/queryDatabaseLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/sidebar/queryDatabaseLogic.tsx
@@ -12,9 +12,9 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { LemonTreeRef, TreeDataItem } from 'lib/lemon-ui/LemonTree/LemonTree'
import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { createFuse, IFuseOptions } from 'lib/utils/fuseSearch'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'
import { POSTHOG_WAREHOUSE } from 'scenes/data-warehouse/editor/connectionSelectorLogic'
-import { sceneLogic } from 'scenes/sceneLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
@@ -2460,11 +2460,11 @@ export const queryDatabaseLogic = kea<queryDatabaseLogicType>([
},
openUnsavedQuery: ({ record }) => {
if (record.insight) {
- sceneLogic.actions.newTab(urls.sqlEditor({ insightShortId: record.insight.short_id }))
+ newInternalTab(urls.sqlEditor({ insightShortId: record.insight.short_id }))
} else if (record.view) {
- sceneLogic.actions.newTab(urls.sqlEditor({ view_id: record.view.id }))
+ newInternalTab(urls.sqlEditor({ view_id: record.view.id }))
} else {
- sceneLogic.actions.newTab(urls.sqlEditor({ query: record.query }))
+ newInternalTab(urls.sqlEditor({ query: record.query }))
}
},
})),
diff --git a/frontend/src/scenes/data-warehouse/scene/modeling/Node.tsx b/frontend/src/scenes/data-warehouse/scene/modeling/Node.tsx
index e7d6b7a9b9b5..60d8ee5b924b 100644
--- a/frontend/src/scenes/data-warehouse/scene/modeling/Node.tsx
+++ b/frontend/src/scenes/data-warehouse/scene/modeling/Node.tsx
@@ -7,7 +7,7 @@ import { IconActivity, IconClockRewind, IconPlay, IconPlayFilled } from '@postho
import { LemonButton, Spinner, Tooltip } from '@posthog/lemon-ui'
import { TZLabel } from 'lib/components/TZLabel'
-import { sceneLogic } from 'scenes/sceneLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { urls } from 'scenes/urls'
import { DataModelingJobStatus, DataModelingNodeType, DataModelingSyncInterval } from '~/types'
@@ -289,7 +289,6 @@ export const NodeInner = React.memo(function NodeInner({
const NodeComponent = React.memo(function NodeComponent(props: { id: string; data: NodeData }): JSX.Element | null {
const { runNode, materializeNode, setHoveredNodeId } = useActions(dataModelingLogic)
const { layoutDirection, highlightedNodeIds, debouncedSearchTerm, parsedSearch } = useValues(dataModelingLogic)
- const { newTab } = useActions(sceneLogic)
const { id } = props
const {
@@ -348,14 +347,14 @@ const NodeComponent = React.memo(function NodeComponent(props: { id: string; dat
if (type === 'endpoint') {
const versionMatch = name.match(/^(.+)_v(\d+)$/)
if (versionMatch) {
- newTab(urls.endpoint(versionMatch[1], parseInt(versionMatch[2])))
+ newInternalTab(urls.endpoint(versionMatch[1], parseInt(versionMatch[2])))
} else {
- newTab(urls.endpoint(name))
+ newInternalTab(urls.endpoint(name))
}
} else {
- newTab(urls.nodeDetail(id))
+ newInternalTab(urls.nodeDetail(id))
}
- }, [type, id, newTab, props.data.name, name])
+ }, [type, id, props.data.name, name])
const handleMouseEnter = useCallback(() => setHoveredNodeId(id), [id, setHoveredNodeId])
const handleMouseLeave = useCallback(() => setHoveredNodeId(null), [setHoveredNodeId])
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentSceneMenuBar.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentSceneMenuBar.tsx
index 790906d7c5f9..161c5fa6b0f7 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentSceneMenuBar.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentSceneMenuBar.tsx
@@ -19,10 +19,10 @@ import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { userHasAccess } from 'lib/utils/accessControlUtils'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
import { organizationLogic } from 'scenes/organizationLogic'
import { projectLogic } from 'scenes/projectLogic'
-import { sceneLogic } from 'scenes/sceneLogic'
import { QuickSurveyType } from 'scenes/surveys/quick-create/types'
import { QuickSurveyModal } from 'scenes/surveys/QuickSurveyModal'
import { urls } from 'scenes/urls'
@@ -77,7 +77,6 @@ function ExperimentSceneMenuBarInner(): JSX.Element | null {
const { currentOrganization } = useValues(organizationLogic)
const { openPauseExperimentModal, openResumeExperimentModal } = useActions(modalsLogic)
const { superpowersEnabled } = useValues(superpowersLogic)
- const { newTab } = useActions(sceneLogic)
const [duplicateModalOpen, setDuplicateModalOpen] = useState(false)
const [copyToProjectModalOpen, setCopyToProjectModalOpen] = useState(false)
@@ -157,7 +156,7 @@ function ExperimentSceneMenuBarInner(): JSX.Element | null {
<SceneMenuBarSubMenu label="Create">
{exposureCohortId ? (
<SceneMenuBarItem
- onClick={() => newTab(urls.cohort(exposureCohortId))}
+ onClick={() => newInternalTab(urls.cohort(exposureCohortId))}
data-attr={`${RESOURCE_TYPE}-menubar-view-exposure-cohort`}
>
<IconEye />
diff --git a/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx b/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
index 518c87d75038..a67bc7d505c6 100644
--- a/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/PageHeader.tsx
@@ -20,10 +20,10 @@ import { superpowersLogic } from 'lib/components/Superpowers/superpowersLogic'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
import { userHasAccess } from 'lib/utils/accessControlUtils'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
import { organizationLogic } from 'scenes/organizationLogic'
import { projectLogic } from 'scenes/projectLogic'
-import { sceneLogic } from 'scenes/sceneLogic'
import { QuickSurveyType } from 'scenes/surveys/quick-create/types'
import { QuickSurveyModal } from 'scenes/surveys/QuickSurveyModal'
import { urls } from 'scenes/urls'
@@ -70,7 +70,6 @@ export function PageHeaderCustom(): JSX.Element {
const [duplicateModalOpen, setDuplicateModalOpen] = useState(false)
const [copyToProjectModalOpen, setCopyToProjectModalOpen] = useState(false)
const [surveyModalOpen, setSurveyModalOpen] = useState(false)
- const { newTab } = useActions(sceneLogic)
const { trigger, HogfettiComponent } = useHogfetti()
useOnMountEffect(() => {
@@ -196,7 +195,7 @@ export function PageHeaderCustom(): JSX.Element {
menuItem: true,
}}
data-attr="view-exposure-cohort"
- onClick={() => newTab(urls.cohort(exposureCohortId))}
+ onClick={() => newInternalTab(urls.cohort(exposureCohortId))}
>
<IconEye /> View exposure cohort as new tab
</Link>
diff --git a/frontend/src/scenes/paths/pathsDataLogic.ts b/frontend/src/scenes/paths/pathsDataLogic.ts
index bcc3d8049e6c..1b5c6bf12b04 100644
--- a/frontend/src/scenes/paths/pathsDataLogic.ts
+++ b/frontend/src/scenes/paths/pathsDataLogic.ts
@@ -2,10 +2,10 @@ import { actions, connect, kea, key, listeners, path, props, selectors } from 'k
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { MathAvailability } from 'scenes/insights/filters/ActionFilter/ActionFilterRow/ActionFilterRow'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
-import { sceneLogic } from 'scenes/sceneLogic'
import { pathsTitle } from 'scenes/trends/persons-modal/persons-modal-utils'
import { OpenPersonsModalProps, openPersonsModal } from 'scenes/trends/persons-modal/PersonsModal'
import { urls } from 'scenes/urls'
@@ -72,7 +72,7 @@ export const pathsDataLogic = kea<pathsDataLogicType>([
featureFlagLogic,
['featureFlags'],
],
- actions: [insightVizDataLogic(props), ['updateInsightFilter', 'updateQuerySource'], sceneLogic, ['newTab']],
+ actions: [insightVizDataLogic(props), ['updateInsightFilter', 'updateQuerySource']],
})),
actions({
@@ -128,7 +128,7 @@ export const pathsDataLogic = kea<pathsDataLogicType>([
],
}),
- listeners(({ actions, values }) => ({
+ listeners(({ values }) => ({
openPersonsModal: ({ path_start_key, path_end_key, path_dropoff_key }) => {
const query: InsightActorsQuery = {
kind: NodeKind.InsightActorsQuery,
@@ -178,7 +178,7 @@ export const pathsDataLogic = kea<pathsDataLogicType>([
},
}
- actions.newTab(urls.insightNew({ query }))
+ newInternalTab(urls.insightNew({ query }))
},
})),
])
diff --git a/playwright/e2e/event-definitions.spec.ts b/playwright/e2e/event-definitions.spec.ts
index 4a5adc88ad28..f80b48d5cadf 100644
--- a/playwright/e2e/event-definitions.spec.ts
+++ b/playwright/e2e/event-definitions.spec.ts
@@ -14,11 +14,16 @@ test.describe('Event Definitions', () => {
const eventName = await page.locator('tbody tr .PropertyKeyInfo__text').first().innerText()
await expect(page.locator('[data-attr=event-definitions-table-view-recordings]').first()).toBeVisible()
+ // View recordings opens the replay page in a new browser tab
+ const popupPromise = page.context().waitForEvent('page')
await page.locator('[data-attr=event-definitions-table-view-recordings]').first().click()
- expect(page.url()).toMatch(/replay/)
+ const replayTab = await popupPromise
+ await expect(replayTab).toHaveURL(/replay/)
- await page.locator('.LemonButton--has-icon .LemonButton__content').filter({ hasText: 'Filters' }).click()
+ await replayTab.locator('.LemonButton--has-icon .LemonButton__content').filter({ hasText: 'Filters' }).click()
- await expect(page.locator('.UniversalFilterButton').first()).toContainText(eventName, { ignoreCase: true })
+ await expect(replayTab.locator('.UniversalFilterButton').first()).toContainText(eventName, {
+ ignoreCase: true,
+ })
})
})
diff --git a/playwright/e2e/sql-editor.spec.ts b/playwright/e2e/sql-editor.spec.ts
index b991370dc39d..3d1946a63ef9 100644
--- a/playwright/e2e/sql-editor.spec.ts
+++ b/playwright/e2e/sql-editor.spec.ts
@@ -61,8 +61,11 @@ test.describe('SQL Editor', () => {
})
test('Add source link', async ({ page }) => {
+ // Add source opens the new-source page in a new browser tab
+ const popupPromise = page.context().waitForEvent('page')
await page.getByTestId('sql-editor-add-source').click()
- await expect(page).toHaveURL(/.*\/data-warehouse\/new-source/)
+ const newSourceTab = await popupPromise
+ await expect(newSourceTab).toHaveURL(/.*\/data-warehouse\/new-source/)
})
test('Run query', async ({ page }) => {
diff --git a/products/error_tracking/frontend/components/IssueActions/IssueActions.tsx b/products/error_tracking/frontend/components/IssueActions/IssueActions.tsx
index 23ec58657069..08daf13da6cf 100644
--- a/products/error_tracking/frontend/components/IssueActions/IssueActions.tsx
+++ b/products/error_tracking/frontend/components/IssueActions/IssueActions.tsx
@@ -3,7 +3,7 @@ import { useActions, useValues } from 'kea'
import { LemonButton, LemonDialog, LemonSelect } from '@posthog/lemon-ui'
import { useHogfetti } from 'lib/components/Hogfetti/Hogfetti'
-import { sceneLogic } from 'scenes/sceneLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { urls } from 'scenes/urls'
import { ErrorTrackingIssue } from '~/queries/schema/schema-general'
@@ -26,7 +26,6 @@ export function IssueActions({ issues, selectedIds }: IssueActionsProps): JSX.El
const { filterGroup } = useValues(issueFiltersLogic)
const { setFilterGroup } = useActions(issueFiltersLogic)
const { setSelectedIssueIds } = useActions(bulkSelectLogic)
- const { newTab } = useActions(sceneLogic)
const { trigger: triggerHogfetti, HogfettiComponent } = useHogfetti()
const hasAtLeastTwoIssues = selectedIds.length >= 2
@@ -35,7 +34,7 @@ export function IssueActions({ issues, selectedIds }: IssueActionsProps): JSX.El
selectedIds.forEach((id) => {
const issue = issues.find((issue) => issue.id === id)
if (issue) {
- newTab(urls.errorTrackingIssue(id, { timestamp: issue.last_seen }))
+ newInternalTab(urls.errorTrackingIssue(id, { timestamp: issue.last_seen }))
}
})
}
diff --git a/products/error_tracking/frontend/components/SimilarIssueCard.tsx b/products/error_tracking/frontend/components/SimilarIssueCard.tsx
index 6cce18752f63..34acc05385cd 100644
--- a/products/error_tracking/frontend/components/SimilarIssueCard.tsx
+++ b/products/error_tracking/frontend/components/SimilarIssueCard.tsx
@@ -1,4 +1,3 @@
-import { useActions } from 'kea'
import { ReactNode } from 'react'
import { IconDirectedGraph, IconOpenSidebar } from '@posthog/icons'
@@ -6,7 +5,7 @@ import { LemonButton } from '@posthog/lemon-ui'
import { getRuntimeFromLib } from 'lib/components/Errors/utils'
import { TZLabel } from 'lib/components/TZLabel'
-import { sceneLogic } from 'scenes/sceneLogic'
+import { newInternalTab } from 'lib/utils/newInternalTab'
import { urls } from 'scenes/urls'
import { ErrorTrackingIssue } from '~/queries/schema/schema-general'
@@ -63,13 +62,12 @@ export default function SimilarIssueCard({
}
function OpenInNewTabAction({ issueId }: { issueId: string }): JSX.Element {
- const { newTab } = useActions(sceneLogic)
return (
<LemonButton
type="secondary"
size="xsmall"
icon={<IconOpenSidebar />}
- onClick={() => newTab(urls.errorTrackingIssue(issueId))}
+ onClick={() => newInternalTab(urls.errorTrackingIssue(issueId))}
tooltip="Open in new tab"
/>
)