Skip to content

Commit 6a8626b

Browse files
committed
fix(FR-2820): decide row actions from record.is_active instead of outer tab state
The deactivate/activate action choice was driven by the isActiveTab prop, which flips immediately on segment change while the GraphQL response is still loading (useDeferredValue). The result: old rows briefly show actions that don't match their actual state. UserManagement decides per-record (record.status === 'active'), so its rows stay consistent during transitions. Apply the same approach here using record.is_active, and remove the now-redundant isActiveTab prop.
1 parent 0a40637 commit 6a8626b

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

packages/backend.ai-ui/src/components/fragments/BAIProjectTable.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ export interface BAIProjectTableProps extends Omit<
5252
) => void;
5353
onClickProjectEditButton: (project: Project) => void;
5454
updateFetchKey?: () => void;
55-
isActiveTab?: boolean;
5655
}
5756

5857
const BAIProjectTable = ({
5958
projectFragment,
6059
onChangeOrder,
6160
onClickProjectEditButton,
6261
updateFetchKey,
63-
isActiveTab = true,
6462
...tableProps
6563
}: BAIProjectTableProps) => {
6664
'use memo';
@@ -148,7 +146,7 @@ const BAIProjectTable = ({
148146
onClickProjectEditButton(record);
149147
},
150148
},
151-
...(isActiveTab
149+
...(record.is_active
152150
? [
153151
{
154152
key: 'deactivate',

react/src/pages/ProjectPage.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ const ProjectPage = () => {
8282

8383
const { supportedFields, exportCSV } = useCSVExport('projects');
8484

85-
const isActiveTab = queryParams.status === 'active';
86-
const statusFilter = isActiveTab ? 'is_active == true' : 'is_active == false';
85+
const statusFilter =
86+
queryParams.status === 'active'
87+
? 'is_active == true'
88+
: 'is_active == false';
8789

8890
const queryVariables: ProjectPageQuery$variables = {
8991
offset: baiPaginationOption.offset,
@@ -222,7 +224,6 @@ const ProjectPage = () => {
222224
</BAIFlex>
223225
<BAIProjectTable
224226
updateFetchKey={updateFetchKey}
225-
isActiveTab={isActiveTab}
226227
projectFragment={filterOutEmpty(
227228
group_nodes?.edges.map((e) => e?.node) ?? [],
228229
)}

0 commit comments

Comments
 (0)