Skip to content

Commit

Permalink
feat: 페이지 삭제 후 활성화 상태 부여 삭제
Browse files Browse the repository at this point in the history
- 꺼진 페이지까지 다시 isActive 되기때문에 사용자 의도와 맞지 않다고 판단

#184
  • Loading branch information
hyonun321 committed Nov 24, 2024
1 parent 5fdb3f1 commit dcd36c6
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions client/src/features/workSpace/hooks/usePagesManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,7 @@ export const usePagesManage = (workspace: WorkSpace | null, clientId: number | n
});

setPages((prevPages) => {
const deletedPage = prevPages.find((page) => page.id === operation.pageId);
const remainingPages = prevPages.filter((page) => page.id !== operation.pageId);

// 삭제된 페이지가 활성화된 상태였다면, 다른 페이지를 활성화
if (deletedPage?.isActive && remainingPages.length > 0) {
const nextActiveIndex = 0; // 첫 번째 페이지를 활성화하거나, 다른 로직으로 선택
remainingPages[nextActiveIndex] = {
...remainingPages[nextActiveIndex],
isActive: true,
isVisible: true,
};
}

return remainingPages;
});
},
Expand Down

0 comments on commit dcd36c6

Please sign in to comment.