|
-
+
@@ -68,3 +52,4 @@ export default function ProjectListTableRow({
|
)
}
+export default memo(ProjectListTableRow)
diff --git a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/archive-projects-button.tsx b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/archive-projects-button.tsx
index 14897b2a8b..43779469f0 100644
--- a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/archive-projects-button.tsx
+++ b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/archive-projects-button.tsx
@@ -9,7 +9,8 @@ import { archiveProject } from '../../../../util/api'
import { Project } from '../../../../../../../../types/project/dashboard/api'
function ArchiveProjectsButton() {
- const { selectedProjects, updateProjectViewData } = useProjectListContext()
+ const { selectedProjects, toggleSelectedProject, updateProjectViewData } =
+ useProjectListContext()
const { t } = useTranslation()
const text = t('archive')
@@ -29,10 +30,10 @@ function ArchiveProjectsButton() {
const handleArchiveProject = async (project: Project) => {
await archiveProject(project.id)
+ toggleSelectedProject(project.id, false)
updateProjectViewData({
...project,
archived: true,
- selected: false,
trashed: false,
})
}
diff --git a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/trash-projects-button.tsx b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/trash-projects-button.tsx
index b57d5cb120..959b252288 100644
--- a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/trash-projects-button.tsx
+++ b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/trash-projects-button.tsx
@@ -9,7 +9,8 @@ import { trashProject } from '../../../../util/api'
import { Project } from '../../../../../../../../types/project/dashboard/api'
function TrashProjectsButton() {
- const { selectedProjects, updateProjectViewData } = useProjectListContext()
+ const { selectedProjects, toggleSelectedProject, updateProjectViewData } =
+ useProjectListContext()
const { t } = useTranslation()
const text = t('trash')
@@ -29,11 +30,11 @@ function TrashProjectsButton() {
const handleTrashProject = async (project: Project) => {
await trashProject(project.id)
+ toggleSelectedProject(project.id, false)
updateProjectViewData({
...project,
trashed: true,
archived: false,
- selected: false,
})
}
diff --git a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/unarchive-projects-button.tsx b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/unarchive-projects-button.tsx
index 8662478bc1..d56e078821 100644
--- a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/unarchive-projects-button.tsx
+++ b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/unarchive-projects-button.tsx
@@ -5,13 +5,15 @@ import { useProjectListContext } from '../../../../context/project-list-context'
import { unarchiveProject } from '../../../../util/api'
function UnarchiveProjectsButton() {
- const { selectedProjects, updateProjectViewData } = useProjectListContext()
+ const { selectedProjects, toggleSelectedProject, updateProjectViewData } =
+ useProjectListContext()
const { t } = useTranslation()
const handleUnarchiveProjects = async () => {
for (const project of selectedProjects) {
await unarchiveProject(project.id)
- updateProjectViewData({ ...project, archived: false, selected: false })
+ toggleSelectedProject(project.id, false)
+ updateProjectViewData({ ...project, archived: false })
}
}
diff --git a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/untrash-projects-button.tsx b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/untrash-projects-button.tsx
index 775eaef30d..ee2081f766 100644
--- a/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/untrash-projects-button.tsx
+++ b/services/web/frontend/js/features/project-list/components/table/project-tools/buttons/untrash-projects-button.tsx
@@ -5,13 +5,15 @@ import { useProjectListContext } from '../../../../context/project-list-context'
import { untrashProject } from '../../../../util/api'
function UntrashProjectsButton() {
- const { selectedProjects, updateProjectViewData } = useProjectListContext()
+ const { selectedProjects, toggleSelectedProject, updateProjectViewData } =
+ useProjectListContext()
const { t } = useTranslation()
const handleUntrashProjects = async () => {
for (const project of selectedProjects) {
await untrashProject(project.id)
- updateProjectViewData({ ...project, trashed: false, selected: false })
+ toggleSelectedProject(project.id, false)
+ updateProjectViewData({ ...project, trashed: false })
}
}
diff --git a/services/web/frontend/js/features/project-list/components/table/project-tools/menu-items/copy-project-menu-item.tsx b/services/web/frontend/js/features/project-list/components/table/project-tools/menu-items/copy-project-menu-item.tsx
index 6515b7bead..934eb2e637 100644
--- a/services/web/frontend/js/features/project-list/components/table/project-tools/menu-items/copy-project-menu-item.tsx
+++ b/services/web/frontend/js/features/project-list/components/table/project-tools/menu-items/copy-project-menu-item.tsx
@@ -13,7 +13,7 @@ function CopyProjectMenuItem() {
const {
addClonedProjectToViewData,
addProjectToTagInView,
- updateProjectViewData,
+ toggleSelectedProject,
selectedProjects,
} = useProjectListContext()
const { t } = useTranslation()
@@ -43,7 +43,7 @@ function CopyProjectMenuItem() {
for (const tag of tags) {
addProjectToTagInView(tag._id, clonedProject.project_id)
}
- updateProjectViewData({ ...project, selected: false })
+ toggleSelectedProject(project.id, false)
if (isMounted.current) {
setShowModal(false)
@@ -54,7 +54,7 @@ function CopyProjectMenuItem() {
selectedProjects,
addClonedProjectToViewData,
addProjectToTagInView,
- updateProjectViewData,
+ toggleSelectedProject,
]
)
diff --git a/services/web/frontend/js/features/project-list/context/project-list-context.tsx b/services/web/frontend/js/features/project-list/context/project-list-context.tsx
index e11f502894..b7859e5e22 100644
--- a/services/web/frontend/js/features/project-list/context/project-list-context.tsx
+++ b/services/web/frontend/js/features/project-list/context/project-list-context.tsx
@@ -96,6 +96,9 @@ export type ProjectListContextValue = {
searchText: string
setSearchText: React.Dispatch