File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
renderer/features/settings/components Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,22 @@ export class FoldersService {
168168 folder . lastAccessed = new Date ( ) . toISOString ( ) ;
169169 foldersStore . set ( "folders" , folders ) ;
170170
171+ // Update all task associations that reference this folder
172+ const associations = foldersStore . get ( "taskAssociations" , [ ] ) ;
173+ let hasChanges = false ;
174+ for ( const assoc of associations ) {
175+ if ( assoc . folderId === folderId ) {
176+ assoc . folderPath = newPath ;
177+ hasChanges = true ;
178+ }
179+ }
180+ if ( hasChanges ) {
181+ foldersStore . set ( "taskAssociations" , associations ) ;
182+ log . debug (
183+ `Updated folder path for ${ associations . filter ( ( a ) => a . folderId === folderId ) . length } task associations` ,
184+ ) ;
185+ }
186+
171187 return { ...folder , exists : true } ;
172188 }
173189
Original file line number Diff line number Diff line change 11import { FolderPicker } from "@features/folder-picker/components/FolderPicker" ;
2+ import { useWorkspaceStore } from "@features/workspace/stores/workspaceStore" ;
23import { useSetHeaderContent } from "@hooks/useSetHeaderContent" ;
34import { Warning } from "@phosphor-icons/react" ;
45import {
@@ -47,10 +48,20 @@ export function FolderSettingsView() {
4748 newPath : path ,
4849 } ) ;
4950 } ,
50- onSuccess : async ( ) => {
51+ onSuccess : async ( _ , newPath ) => {
5152 await loadFolders ( ) ;
5253 queryClient . invalidateQueries ( { queryKey : [ "folders" ] } ) ;
5354 setError ( null ) ;
55+
56+ if ( folderId ) {
57+ const { workspaces, updateWorkspace } = useWorkspaceStore . getState ( ) ;
58+ for ( const [ taskId , workspace ] of Object . entries ( workspaces ) ) {
59+ if ( workspace . folderId === folderId ) {
60+ updateWorkspace ( taskId , { ...workspace , folderPath : newPath } ) ;
61+ }
62+ }
63+ await useWorkspaceStore . getState ( ) . loadWorkspaces ( ) ;
64+ }
5465 } ,
5566 onError : ( err ) => {
5667 log . error ( "Failed to update folder path:" , err ) ;
You can’t perform that action at this time.
0 commit comments