Skip to content

Commit

Permalink
fix(chat): select folder on rename & create (Issue #2022, #2421) (#2768)
Browse files Browse the repository at this point in the history
Co-authored-by: Magomed-Elbi Dzhukalaev <magomed-elbi_dzhukalaev@epam.com>
Co-authored-by: Ilya Bondar <ilya_bondar@epam.com>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent a0ab0e7 commit 444e660
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions apps/chat/src/components/Chat/ChangePathDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ export const ChangePathDialog = ({
return;
}

setSelectedFolderId(
constructPath(getFolderIdFromEntityId(folderId), newName),
);
setSelectedFolderId(newFolderId);

if (error) {
setErrorMessage(t(error) as string);
Expand All @@ -172,7 +170,7 @@ export const ChangePathDialog = ({
(parentFolderId = rootFolderId) => {
const folderName = getNextDefaultName(
t(DEFAULT_FOLDER_NAME),
folders,
folders.filter((f) => f.folderId === parentFolderId),
0,
false,
true,
Expand Down
4 changes: 3 additions & 1 deletion apps/chat/src/store/prompts/prompts.reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ export const promptsSlice = createSlice({
const name = payload.name.trim();

state.temporaryFolders = state.temporaryFolders.map((folder) =>
folder.id !== payload.folderId ? folder : { ...folder, name },
folder.id !== payload.folderId
? folder
: { ...folder, name, id: constructPath(folder.folderId, name) },
);
},
resetNewFolderId: (state) => {
Expand Down

0 comments on commit 444e660

Please sign in to comment.