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

View File

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

View File

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