mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 00:03:08 +00:00
Remove onboarding modal cleanup guard
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -48,10 +48,7 @@ import { StarNagCard } from './components/StarNagCard'
|
||||
import { TelemetryFirstLaunchSurface } from './components/TelemetryFirstLaunchSurface'
|
||||
import { ZoomOverlay } from './components/ZoomOverlay'
|
||||
import { onOnboardingReopened } from './components/onboarding/show-onboarding-event'
|
||||
import {
|
||||
shouldCloseAppModalForOnboarding,
|
||||
shouldShowOnboarding
|
||||
} from './components/onboarding/should-show-onboarding'
|
||||
import { shouldShowOnboarding } from './components/onboarding/should-show-onboarding'
|
||||
import { SshPassphraseDialog } from './components/settings/SshPassphraseDialog'
|
||||
import DeleteWorktreeDialog from './components/sidebar/DeleteWorktreeDialog'
|
||||
import {
|
||||
@@ -475,22 +472,6 @@ function App(): React.JSX.Element {
|
||||
actions.setContextualToursOnboardingVisible(suppressTours)
|
||||
}, [actions, onboarding, onboardingLoaded])
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!shouldCloseAppModalForOnboarding({
|
||||
onboarding,
|
||||
onboardingSettingsDetour,
|
||||
activeModal
|
||||
})
|
||||
) {
|
||||
return
|
||||
}
|
||||
// Why: Radix dialogs underneath onboarding treat clicks inside onboarding
|
||||
// as outside interactions. Onboarding owns the first-run screen, so clear
|
||||
// app modals instead of leaving a hidden dismissable layer mounted.
|
||||
actions.closeModal()
|
||||
}, [actions, activeModal, onboarding, onboardingSettingsDetour])
|
||||
|
||||
useEffect(() => {
|
||||
if (!persistedUIReady || !onboardingLoaded || contextualToursAutoEligible !== null) {
|
||||
return
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { OnboardingState } from '../../../../shared/types'
|
||||
import { shouldCloseAppModalForOnboarding, shouldShowOnboarding } from './should-show-onboarding'
|
||||
|
||||
function makeOnboarding(overrides: Partial<OnboardingState> = {}): OnboardingState {
|
||||
return {
|
||||
closedAt: null,
|
||||
outcome: null,
|
||||
lastCompletedStep: -1,
|
||||
checklist: {
|
||||
addedRepo: false,
|
||||
choseAgent: false,
|
||||
ranFirstAgent: false,
|
||||
ranSecondAgentOnSameTask: false,
|
||||
triedCmdJ: false,
|
||||
shapedSidebar: false,
|
||||
reviewedDiff: false,
|
||||
openedPr: false,
|
||||
addedFolder: false,
|
||||
openedFile: false,
|
||||
ranAgentOnFile: false,
|
||||
dismissed: false
|
||||
},
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
describe('shouldShowOnboarding', () => {
|
||||
it('shows onboarding until it has a closed timestamp', () => {
|
||||
expect(shouldShowOnboarding(makeOnboarding())).toBe(true)
|
||||
expect(shouldShowOnboarding(makeOnboarding({ closedAt: 123 }))).toBe(false)
|
||||
expect(shouldShowOnboarding(null)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('shouldCloseAppModalForOnboarding', () => {
|
||||
it('closes app modals while first-run onboarding owns the screen', () => {
|
||||
expect(
|
||||
shouldCloseAppModalForOnboarding({
|
||||
onboarding: makeOnboarding(),
|
||||
onboardingSettingsDetour: false,
|
||||
activeModal: 'feature-tips'
|
||||
})
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps modals when onboarding is closed, absent, detoured, or no modal is active', () => {
|
||||
expect(
|
||||
shouldCloseAppModalForOnboarding({
|
||||
onboarding: makeOnboarding({ closedAt: 123 }),
|
||||
onboardingSettingsDetour: false,
|
||||
activeModal: 'feature-tips'
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
shouldCloseAppModalForOnboarding({
|
||||
onboarding: null,
|
||||
onboardingSettingsDetour: false,
|
||||
activeModal: 'feature-tips'
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
shouldCloseAppModalForOnboarding({
|
||||
onboarding: makeOnboarding(),
|
||||
onboardingSettingsDetour: true,
|
||||
activeModal: 'feature-tips'
|
||||
})
|
||||
).toBe(false)
|
||||
expect(
|
||||
shouldCloseAppModalForOnboarding({
|
||||
onboarding: makeOnboarding(),
|
||||
onboardingSettingsDetour: false,
|
||||
activeModal: 'none'
|
||||
})
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -5,15 +5,3 @@ import type { OnboardingState } from '../../../../shared/types'
|
||||
export function shouldShowOnboarding(onboarding: OnboardingState | null): boolean {
|
||||
return onboarding !== null && onboarding.closedAt === null
|
||||
}
|
||||
|
||||
export function shouldCloseAppModalForOnboarding(args: {
|
||||
onboarding: OnboardingState | null
|
||||
onboardingSettingsDetour: boolean
|
||||
activeModal: string
|
||||
}): boolean {
|
||||
return (
|
||||
shouldShowOnboarding(args.onboarding) &&
|
||||
!args.onboardingSettingsDetour &&
|
||||
args.activeModal !== 'none'
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user