Merge branch 'main' into next
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase Backend Test / sqlite-test (20, false) (push) Waiting to run
NocoBase Backend Test / sqlite-test (20, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (public, 20, public, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, nocobase, true) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, false) (push) Waiting to run
NocoBase Backend Test / postgres-test (user_schema, 20, public, true) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, false) (push) Waiting to run
NocoBase Backend Test / mysql-test (20, true) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, false) (push) Waiting to run
NocoBase Backend Test / mariadb-test (20, true) (push) Waiting to run
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Test on Windows / build (push) Waiting to run

This commit is contained in:
GitHub Actions Bot 2024-09-11 09:21:37 +00:00
commit b830604348
3 changed files with 17 additions and 11 deletions

View File

@ -190,7 +190,7 @@ export const usePopupUtils = (
[association, cm, collection, dataSourceKey, parentRecord?.data, association],
);
const getPopupContext = useCallback(() => {
const getNewPopupContext = useCallback(() => {
const context = {
dataSource: dataSourceKey,
collection: association ? undefined : collection?.name,
@ -247,7 +247,7 @@ export const usePopupUtils = (
sourceId,
});
updatePopupContext(getPopupContext(), customActionSchema);
updatePopupContext(getNewPopupContext(), customActionSchema);
navigate(withSearchParams(`${url}${pathname}`));
},
@ -265,7 +265,7 @@ export const usePopupUtils = (
location,
isPopupVisibleControlledByURL,
getSourceId,
getPopupContext,
getNewPopupContext,
],
);
@ -344,7 +344,7 @@ export const usePopupUtils = (
* @deprecated
* TODO: remove this
*/
getPopupContext,
getPopupContext: getNewPopupContext,
};
};

View File

@ -16,6 +16,10 @@ export interface PopupContext {
dataSource?: string;
collection?: string;
association?: string;
/**
* if true, the context will never be updated
*/
doNotUpdateContext?: boolean;
}
export const CONTEXT_SCHEMA_KEY = 'x-action-context';
@ -29,20 +33,21 @@ export const usePopupContextInActionOrAssociationField = () => {
const { dn } = useDesignable();
const updatePopupContext = useCallback(
(context: PopupContext, customSchema?: ISchema) => {
customSchema = customSchema || fieldSchema;
context = _.omitBy(context, _.isNil) as PopupContext;
(newContext: PopupContext, customSchema?: ISchema) => {
const schema = customSchema || fieldSchema;
const oldContext = getPopupContextFromActionOrAssociationFieldSchema(schema);
newContext = _.omitBy(newContext, _.isNil) as PopupContext;
if (_.isEqual(context, getPopupContextFromActionOrAssociationFieldSchema(customSchema))) {
if (_.isEqual(newContext, oldContext) || oldContext?.doNotUpdateContext) {
return;
}
customSchema[CONTEXT_SCHEMA_KEY] = context;
schema[CONTEXT_SCHEMA_KEY] = newContext;
return dn.emit('initializeActionContext', {
schema: {
'x-uid': customSchema['x-uid'],
[CONTEXT_SCHEMA_KEY]: context,
'x-uid': schema['x-uid'],
[CONTEXT_SCHEMA_KEY]: newContext,
},
});
},

View File

@ -406,6 +406,7 @@ export function getWorkflowTodoViewActionSchema({ defaultOpenMode, collectionNam
'x-action-context': {
dataSource: 'main',
collection: collectionName,
doNotUpdateContext: true,
},
properties: {
drawer: {