File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
src/features/threads/hooks Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -424,14 +424,24 @@ pub(crate) async fn list_threads_core(
424424 . get ( "directory" )
425425 . and_then ( |v| v. as_str ( ) )
426426 . unwrap_or_default ( ) ;
427- Some ( json ! ( {
427+ let parent_id = s
428+ . get ( "parentID" )
429+ . or_else ( || s. get ( "parentId" ) )
430+ . or_else ( || s. get ( "parent_id" ) )
431+ . and_then ( |v| v. as_str ( ) )
432+ . filter ( |s| !s. is_empty ( ) ) ;
433+ let mut entry = json ! ( {
428434 "id" : id,
429435 "cwd" : directory,
430436 "name" : title,
431437 "preview" : title,
432438 "updatedAt" : updated_at,
433439 "createdAt" : updated_at
434- } ) )
440+ } ) ;
441+ if let Some ( pid) = parent_id {
442+ entry[ "parentId" ] = json ! ( pid) ;
443+ }
444+ Some ( entry)
435445 } )
436446 . collect ( ) ;
437447 Ok ( json ! ( {
Original file line number Diff line number Diff line change @@ -476,8 +476,10 @@ export function useThreadActions({
476476 return ;
477477 }
478478 const sourceParentId = getParentThreadIdFromSource ( thread . source ) ;
479- if ( sourceParentId ) {
480- updateThreadParent ( sourceParentId , [ threadId ] ) ;
479+ const directParentId = asString ( thread . parentId ?? thread . parent_id ?? "" ) . trim ( ) || null ;
480+ const resolvedParentId = sourceParentId ?? directParentId ;
481+ if ( resolvedParentId ) {
482+ updateThreadParent ( resolvedParentId , [ threadId ] ) ;
481483 }
482484 const timestamp = getThreadTimestamp ( thread ) ;
483485 if ( timestamp > ( nextActivityByThread [ threadId ] ?? 0 ) ) {
@@ -662,8 +664,10 @@ export function useThreadActions({
662664 return ;
663665 }
664666 const sourceParentId = getParentThreadIdFromSource ( thread . source ) ;
665- if ( sourceParentId ) {
666- updateThreadParent ( sourceParentId , [ id ] ) ;
667+ const directParentId = asString ( thread . parentId ?? thread . parent_id ?? "" ) . trim ( ) || null ;
668+ const resolvedParentId = sourceParentId ?? directParentId ;
669+ if ( resolvedParentId ) {
670+ updateThreadParent ( resolvedParentId , [ id ] ) ;
667671 }
668672 const preview = asString ( thread ?. preview ?? "" ) . trim ( ) ;
669673 const explicitName = asString ( thread ?. name ?? thread ?. title ?? "" ) . trim ( ) ;
You can’t perform that action at this time.
0 commit comments