diff --git a/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx b/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx
index a4fa2cf9c7..8506d4a7ec 100644
--- a/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx
+++ b/frontend/src/component/archive/ArchiveTable/ArchiveTable.tsx
@@ -27,7 +27,7 @@ import { FeatureSeenCell } from '../../common/Table/cells/FeatureSeenCell/Featur
import { LinkCell } from '../../common/Table/cells/LinkCell/LinkCell';
import { FeatureStaleCell } from '../../feature/FeatureToggleList/FeatureStaleCell/FeatureStaleCell';
import { TimeAgoCell } from '../../common/Table/cells/TimeAgoCell/TimeAgoCell';
-import { ReviveArchivedFeatureCell } from 'component/common/Table/cells/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell';
+import { ReviveArchivedFeatureCell } from 'component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell';
import { useStyles } from '../../feature/FeatureToggleList/styles';
import { useVirtualizedRange } from '../../../hooks/useVirtualizedRange';
import {
@@ -68,21 +68,22 @@ export const ArchiveTable = ({
const { reviveFeature } = useFeatureArchiveApi();
- const onRevive = (feature: string) => {
- reviveFeature(feature)
- .then(refetch)
- .then(() =>
- setToastData({
- type: 'success',
- title: "And we're back!",
- text: 'The feature toggle has been revived.',
- confetti: true,
- })
- )
- .catch(e => setToastApiError(e.toString()));
+ const onRevive = async (feature: string) => {
+ try {
+ await reviveFeature(feature);
+ await refetch();
+ setToastData({
+ type: 'success',
+ title: "And we're back!",
+ text: 'The feature toggle has been revived.',
+ confetti: true,
+ });
+ } catch (e: any) {
+ setToastApiError(e.toString());
+ }
};
- const columns = useColumns(onRevive);
+ const columns = getColumns(onRevive);
const data = useMemo(
() =>
@@ -160,6 +161,41 @@ export const ArchiveTable = ({
const [firstRenderedIndex, lastRenderedIndex] =
useVirtualizedRange(rowHeight);
+ const renderRows = () => {
+ return (
+ <>
+ {rows.map((row, index) => {
+ const isVirtual =
+ index < firstRenderedIndex || index > lastRenderedIndex;
+
+ if (isVirtual) {
+ return null;
+ }
+
+ prepareRow(row);
+ return (
+
+ {row.cells.map(cell => (
+
+ {cell.render('Cell')}
+
+ ))}
+
+ );
+ })}
+ >
+ );
+ };
+
return (
- {rows.map((row, index) => {
- const isVirtual =
- index < firstRenderedIndex ||
- index > lastRenderedIndex;
-
- if (isVirtual) {
- return null;
- }
-
- prepareRow(row);
- return (
-
- {row.cells.map(cell => (
-
- {cell.render('Cell')}
-
- ))}
-
- );
- })}
+ {renderRows()}
@@ -249,7 +252,7 @@ export const ArchiveTable = ({
);
};
-const useColumns = (onRevive: any) => {
+function getColumns(onRevive: (feature: string) => Promise) {
return [
{
id: 'Seen',
@@ -323,4 +326,4 @@ const useColumns = (onRevive: any) => {
),
},
];
-};
+}
diff --git a/frontend/src/component/common/Table/cells/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx b/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx
similarity index 84%
rename from frontend/src/component/common/Table/cells/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx
rename to frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx
index 4c062d0e03..e8271a1c77 100644
--- a/frontend/src/component/common/Table/cells/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx
+++ b/frontend/src/component/archive/ArchiveTable/ReviveArchivedFeatureCell/ReviveArchivedFeatureCell.tsx
@@ -1,5 +1,5 @@
import { VFC } from 'react';
-import { ActionCell } from '../ActionCell/ActionCell';
+import { ActionCell } from '../../../common/Table/cells/ActionCell/ActionCell';
import { Undo } from '@mui/icons-material';
import { IconButton } from '@mui/material';
diff --git a/frontend/src/component/archive/FeaturesArchiveTable.tsx b/frontend/src/component/archive/FeaturesArchiveTable.tsx
index d728ca9c70..e7a4d55bae 100644
--- a/frontend/src/component/archive/FeaturesArchiveTable.tsx
+++ b/frontend/src/component/archive/FeaturesArchiveTable.tsx
@@ -3,10 +3,12 @@ import { ArchiveTable } from './ArchiveTable/ArchiveTable';
import { useSearchParams } from 'react-router-dom';
import { useLocalStorage } from '../../hooks/useLocalStorage';
import { SortingRule } from 'react-table';
+import { usePageTitle } from '../../hooks/usePageTitle';
const defaultSort: SortingRule = { id: 'createdAt', desc: true };
export const FeaturesArchiveTable = () => {
+ usePageTitle('Archived');
const {
archivedFeatures = [],
loading,
diff --git a/frontend/src/component/project/Project/ProjectFeaturesArchive/ProjectFeaturesArchive.tsx b/frontend/src/component/project/Project/ProjectFeaturesArchive/ProjectFeaturesArchive.tsx
index 7685944eea..4dff9aedcd 100644
--- a/frontend/src/component/project/Project/ProjectFeaturesArchive/ProjectFeaturesArchive.tsx
+++ b/frontend/src/component/project/Project/ProjectFeaturesArchive/ProjectFeaturesArchive.tsx
@@ -1,4 +1,5 @@
import { ProjectFeaturesArchiveTable } from '../../../archive/ProjectFeaturesArchiveTable';
+import { usePageTitle } from '../../../../hooks/usePageTitle';
interface IProjectFeaturesArchiveProps {
projectId: string;
@@ -7,7 +8,7 @@ interface IProjectFeaturesArchiveProps {
export const ProjectFeaturesArchive = ({
projectId,
}: IProjectFeaturesArchiveProps) => {
- // usePageTitle('Project Archived Features');
+ usePageTitle('Project Archived Features');
return ;
};