fix: after selecting all, bulk update prompts for unselected data (#4010)

This commit is contained in:
katherinehhh 2024-04-11 14:56:37 +08:00 committed by GitHub
parent 82df150c30
commit 4c3dc89f66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,6 @@ import {
useCollection_deprecated, useCollection_deprecated,
useCompile, useCompile,
useLocalVariables, useLocalVariables,
useRecord,
useTableBlockContext, useTableBlockContext,
useVariables, useVariables,
} from '@nocobase/client'; } from '@nocobase/client';
@ -23,18 +22,15 @@ export const useCustomizeBulkUpdateActionProps = () => {
const actionSchema = useFieldSchema(); const actionSchema = useFieldSchema();
const tableBlockContext = useTableBlockContext(); const tableBlockContext = useTableBlockContext();
const { rowKey } = tableBlockContext; const { rowKey } = tableBlockContext;
const selectedRecordKeys =
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
const navigate = useNavigate(); const navigate = useNavigate();
const compile = useCompile(); const compile = useCompile();
const { t } = useBulkUpdateTranslation(); const { t } = useBulkUpdateTranslation();
const actionField: any = useField(); const actionField: any = useField();
const { modal } = App.useApp(); const { modal } = App.useApp();
const variables = useVariables(); const variables = useVariables();
const record = useRecord();
const { name, getField } = useCollection_deprecated(); const { name, getField } = useCollection_deprecated();
const localVariables = useLocalVariables(); const localVariables = useLocalVariables();
return { return {
async onClick(e, callBack) { async onClick(e, callBack) {
const { const {
@ -44,6 +40,8 @@ export const useCustomizeBulkUpdateActionProps = () => {
} = actionSchema?.['x-action-settings'] ?? {}; } = actionSchema?.['x-action-settings'] ?? {};
actionField.data = field.data || {}; actionField.data = field.data || {};
actionField.data.loading = true; actionField.data.loading = true;
const selectedRecordKeys =
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
const assignedValues = {}; const assignedValues = {};
const waitList = Object.keys(originalAssignedValues).map(async (key) => { const waitList = Object.keys(originalAssignedValues).map(async (key) => {