@@ -31,6 +31,7 @@ type DialogMoveSessionProps = {
3131 onSelect : ( selection : MoveSessionSelection ) => void
3232 onCurrentChange ?: ( selection : MoveSessionSelection ) => void
3333 initialDirectories ?: ReadonlyArray < ProjectDirectory >
34+ fixture ?: boolean
3435 initialRemoving ?: string
3536}
3637
@@ -75,7 +76,7 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
7576 } )
7677
7778 const [ directories , { refetch } ] = createResource (
78- ( ) => ( props . initialRemoving ? undefined : props . projectID ) ,
79+ ( ) => ( props . fixture || props . initialRemoving ? undefined : props . projectID ) ,
7980 async ( projectID , info ) : Promise < ReadonlyArray < ProjectDirectory > | undefined > => {
8081 try {
8182 const requestLocation = { directory : location ( ) ?. directory || paths . cwd }
@@ -110,11 +111,9 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
110111 if ( showError ( ) ) return
111112 const directory = currentDirectory ( )
112113 if ( ! directory ) return
113- return (
114- directoryData ( )
115- ?. filter ( ( root ) => contains ( root . directory , directory ) )
116- . toSorted ( ( a , b ) => b . directory . length - a . directory . length ) [ 0 ] ?? { directory }
117- )
114+ return directoryData ( )
115+ ?. filter ( ( root ) => contains ( root . directory , directory ) )
116+ . toSorted ( ( a , b ) => b . directory . length - a . directory . length ) [ 0 ]
118117 } )
119118
120119 const options = createMemo < DialogSelectOption < MoveSessionSelection | undefined > [ ] > ( ( ) => {
@@ -123,7 +122,6 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
123122 const current = currentRoot ( ) ?. directory
124123 if ( directories . loading && ! data && ! current ) return [ ]
125124 const roots = [ ...( data ?? [ ] ) ]
126- if ( current && ! roots . some ( ( item ) => item . directory === current ) ) roots . unshift ( { directory : current } )
127125 roots . sort ( ( a , b ) => {
128126 if ( a . directory === current ) return - 1
129127 if ( b . directory === current ) return 1
@@ -139,15 +137,13 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
139137 ( session ) => session . projectID === props . projectID && session . subpath && ! [ "." , "/" ] . includes ( session . subpath ) ,
140138 )
141139 . map ( ( session ) => session . location . directory )
140+ . filter ( ( directory ) => currentRoot ( ) || directory !== currentDirectory ( ) )
142141 . filter ( ( directory ) => ! roots . some ( ( root ) => root . directory === directory ) )
143142 . filter ( ( directory , index , directories ) => directories . indexOf ( directory ) === index )
144143 . map ( ( location ) => ( {
145144 location,
146145 root : roots
147- . filter ( ( root ) => {
148- const relative = path . relative ( root . directory , location )
149- return relative && relative !== ".." && ! relative . startsWith ( ".." + path . sep ) && ! path . isAbsolute ( relative )
150- } )
146+ . filter ( ( root ) => contains ( root . directory , location ) )
151147 . toSorted ( ( a , b ) => b . directory . length - a . directory . length ) [ 0 ] ,
152148 } ) )
153149 . filter ( ( item ) : item is { location : string ; root : ProjectDirectory } => item . root !== undefined )
@@ -325,6 +321,7 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
325321 </ box >
326322 }
327323 renderFilter = { ! showError ( ) }
324+ flat = { true }
328325 options = { options ( ) }
329326 emptyView = {
330327 showError ( ) ? (
@@ -357,7 +354,7 @@ export function DialogMoveSession(props: DialogMoveSessionProps) {
357354 } }
358355 onMove = { ( ) => setToDelete ( undefined ) }
359356 actions = {
360- showError ( )
357+ showError ( ) || props . fixture
361358 ? [ ]
362359 : [
363360 {
0 commit comments