event.preventDefault()}
>
@@ -37,7 +27,7 @@ export function MobileEmulatorTabIntroCallout({
size="sm"
variant="outline"
className="h-6 px-2 text-[11px]"
- onClick={() => runAndNotify(keepIntro)}
+ onClick={keepIntro}
>
{translate(
'auto.components.emulator.pane.MobileEmulatorTabIntroCallout.8014b4b80b',
@@ -49,7 +39,7 @@ export function MobileEmulatorTabIntroCallout({
size="sm"
variant="ghost"
className="h-6 px-2 text-[11px] text-muted-foreground"
- onClick={() => runAndNotify(hideIntro)}
+ onClick={hideIntro}
>
{translate(
'auto.components.emulator.pane.MobileEmulatorTabIntroCallout.6e051a40b7',
@@ -67,7 +57,7 @@ export function MobileEmulatorTabIntroCallout({
'Dismiss'
)}
className="size-6 text-muted-foreground"
- onClick={() => runAndNotify(dismissIntro)}
+ onClick={dismissIntro}
>
diff --git a/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.test.tsx b/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.test.tsx
new file mode 100644
index 000000000..9ec333557
--- /dev/null
+++ b/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.test.tsx
@@ -0,0 +1,37 @@
+// @vitest-environment happy-dom
+
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { toast } from 'sonner'
+import type { AppState } from '@/store/types'
+import { showMobileEmulatorHiddenToast } from './mobile-emulator-hidden-toast'
+
+vi.mock('sonner', () => ({
+ toast: {
+ dismiss: vi.fn(),
+ info: vi.fn()
+ }
+}))
+
+afterEach(() => {
+ vi.clearAllMocks()
+})
+
+describe('showMobileEmulatorHiddenToast', () => {
+ it('auto-dismisses after 30s while staying dismissible', () => {
+ showMobileEmulatorHiddenToast({
+ openSettingsPage: vi.fn() as unknown as AppState['openSettingsPage'],
+ openSettingsTarget: vi.fn() as unknown as AppState['openSettingsTarget']
+ })
+
+ const infoMock = vi.mocked(toast.info)
+ expect(infoMock).toHaveBeenCalledTimes(1)
+ const options = infoMock.mock.calls[0]?.[1]
+ // Why: a finite duration is the fix for the toast lingering forever; assert
+ // the exact value so a regression to Infinity is caught.
+ expect(options).toMatchObject({
+ id: 'mobile-emulator-hidden',
+ duration: 30_000,
+ dismissible: true
+ })
+ })
+})
diff --git a/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.tsx b/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.tsx
index d73a0ccdc..d62b44f9f 100644
--- a/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.tsx
+++ b/src/renderer/src/components/emulator-pane/mobile-emulator-hidden-toast.tsx
@@ -3,6 +3,9 @@ import type { AppState } from '@/store/types'
import { translate } from '@/i18n/i18n'
const MOBILE_EMULATOR_HIDDEN_TOAST_ID = 'mobile-emulator-hidden'
+// Why: auto-dismiss the nudge after 30s so it can't linger forever; it stays
+// dismissible early and the Settings re-enable link is reachable until then.
+const MOBILE_EMULATOR_HIDDEN_TOAST_DURATION_MS = 30_000
type MobileEmulatorHiddenToastDeps = {
openSettingsPage: AppState['openSettingsPage']
@@ -10,8 +13,6 @@ type MobileEmulatorHiddenToastDeps = {
}
export function showMobileEmulatorHiddenToast(deps: MobileEmulatorHiddenToastDeps): void {
- // Why: matches other one-time opt-out nudges — stay on screen until the user
- // dismisses it so the Settings re-enable path is easy to find.
toast.info(
translate(
'auto.components.emulator.pane.mobile.emulator.hidden.toast.e8f098a870',
@@ -42,7 +43,7 @@ export function showMobileEmulatorHiddenToast(deps: MobileEmulatorHiddenToastDep
.
),
- duration: Infinity,
+ duration: MOBILE_EMULATOR_HIDDEN_TOAST_DURATION_MS,
dismissible: true
}
)
diff --git a/src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx b/src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx
index f83485ff1..137c20f63 100644
--- a/src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx
+++ b/src/renderer/src/components/emulator-pane/use-mobile-emulator-tab-intro-actions.test.tsx
@@ -121,7 +121,7 @@ describe('useMobileEmulatorTabIntroActions', () => {
expect(closeUnifiedTab).toHaveBeenCalledWith('simulator-tab')
expect(toast.info).toHaveBeenCalledWith(
'Mobile Emulator hidden',
- expect.objectContaining({ id: 'mobile-emulator-hidden' })
+ expect.objectContaining({ id: 'mobile-emulator-hidden', duration: 30_000 })
)
expect(toast.error).not.toHaveBeenCalled()
})
diff --git a/src/renderer/src/components/tab-bar/TabBar.tsx b/src/renderer/src/components/tab-bar/TabBar.tsx
index 5f5982f49..fc7008ae6 100644
--- a/src/renderer/src/components/tab-bar/TabBar.tsx
+++ b/src/renderer/src/components/tab-bar/TabBar.tsx
@@ -769,7 +769,7 @@ function TabBarInner({
isMacOs &&
mobileEmulatorEnabled &&
onNewSimulatorTab ? (
-
setNewTabMenuOpen(false)} />
+
) : null
const standardCreateMenuItems =
newTabMenuOrder === 'markdown-first' ? (
@@ -1193,7 +1193,14 @@ function TabBarInner({
) : null}
-
+