mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
Clear settings search when opening settings (#3380)
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
} from '../../../../shared/types'
|
||||
import { createUISlice } from './ui'
|
||||
import { createWorktreeNavHistorySlice } from './worktree-nav-history'
|
||||
import { createSettingsSearchState } from './settings-search-state'
|
||||
import type { AppState } from '../types'
|
||||
import type { FeatureInteractionState } from '../../../../shared/feature-interactions'
|
||||
|
||||
@@ -28,6 +29,7 @@ function createUIStore(): StoreApi<AppState> {
|
||||
worktreesByRepo: {},
|
||||
rightSidebarOpen: false,
|
||||
rightSidebarWidth: 280,
|
||||
...createSettingsSearchState(args[0]),
|
||||
...createWorktreeNavHistorySlice(...(args as Parameters<typeof createWorktreeNavHistorySlice>)),
|
||||
...createUISlice(...(args as Parameters<typeof createUISlice>))
|
||||
})) as unknown as StoreApi<AppState>
|
||||
@@ -680,6 +682,17 @@ describe('createUISlice settings navigation', () => {
|
||||
|
||||
expect(store.getState().activeView).toBe('tasks')
|
||||
})
|
||||
|
||||
it('clears transient settings search when opening settings', () => {
|
||||
const store = createUIStore()
|
||||
|
||||
store.setState({ settingsSearchInputQuery: 'terminal', settingsSearchQuery: 'terminal' })
|
||||
store.getState().openSettingsPage()
|
||||
|
||||
expect(store.getState().activeView).toBe('settings')
|
||||
expect(store.getState().settingsSearchInputQuery).toBe('')
|
||||
expect(store.getState().settingsSearchQuery).toBe('')
|
||||
})
|
||||
})
|
||||
|
||||
describe('createUISlice page navigation history', () => {
|
||||
|
||||
@@ -894,7 +894,10 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
|
||||
})),
|
||||
setNewWorkspaceDraft: (draft) => set({ newWorkspaceDraft: draft }),
|
||||
clearNewWorkspaceDraft: () => set({ newWorkspaceDraft: null }),
|
||||
openSettingsPage: () =>
|
||||
openSettingsPage: () => {
|
||||
// Why: settings search is a transient page filter; opening Settings
|
||||
// should never inherit hidden sections from the previous visit.
|
||||
get().setSettingsSearchQuery('')
|
||||
set((state) => ({
|
||||
activeView: 'settings',
|
||||
// Why: Settings is a temporary detour from either terminal or the
|
||||
@@ -903,7 +906,8 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
|
||||
// dumping the user into terminal.
|
||||
previousViewBeforeSettings:
|
||||
state.activeView === 'settings' ? state.previousViewBeforeSettings : state.activeView
|
||||
})),
|
||||
}))
|
||||
},
|
||||
closeSettingsPage: () =>
|
||||
set((state) => {
|
||||
const previousView =
|
||||
|
||||
Reference in New Issue
Block a user