mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:55:44 +00:00
fix(popup): fix URL anomalies caused by using popups together with Link buttons (#5219)
* fix(popup): resolve URL issues caused by popups used with Link buttons * chore: make e2e tests pass
This commit is contained in:
parent
b2dd68faff
commit
1e7a740f66
@ -40,7 +40,7 @@ test.describe('sub page', () => {
|
|||||||
page.getByLabel('block-item-Markdown.Void-').getByText('Markdown:从弹窗中打开的子页面,tab2。'),
|
page.getByLabel('block-item-Markdown.Void-').getByText('Markdown:从弹窗中打开的子页面,tab2。'),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await page.getByLabel('back-button').click();
|
await page.getByLabel('back-button').click();
|
||||||
await page.goBack();
|
await page.getByLabel('drawer-Action.Container-users-View record-mask').click();
|
||||||
|
|
||||||
// 从嵌套弹窗中打开子页面 --------------------------------------------------------------------
|
// 从嵌套弹窗中打开子页面 --------------------------------------------------------------------
|
||||||
await page.getByLabel('action-Action.Link-View-view-').nth(2).click();
|
await page.getByLabel('action-Action.Link-View-view-').nth(2).click();
|
||||||
|
@ -48,10 +48,6 @@ export interface PopupContextStorage extends PopupContext {
|
|||||||
/** used to refresh data for block */
|
/** used to refresh data for block */
|
||||||
service?: any;
|
service?: any;
|
||||||
sourceId?: string;
|
sourceId?: string;
|
||||||
/**
|
|
||||||
* if true, will not back to the previous path when closing the popup
|
|
||||||
*/
|
|
||||||
notBackToPreviousPath?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const popupsContextStorage: Record<string, PopupContextStorage> = {};
|
const popupsContextStorage: Record<string, PopupContextStorage> = {};
|
||||||
@ -279,14 +275,7 @@ export const usePopupUtils = (
|
|||||||
return setVisibleFromAction?.(false);
|
return setVisibleFromAction?.(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. If there is a value in the cache, it means that the current popup was opened by manual click, so we can simply return to the previous record;
|
navigate(withSearchParams(removeLastPopupPath(location.pathname)), { replace: true });
|
||||||
// 2. If there is no value in the cache, it means that the current popup was opened by clicking the URL elsewhere, and since there is no history,
|
|
||||||
// we need to construct the URL of the previous record to return to;
|
|
||||||
if (getStoredPopupContext(currentPopupUid) && !getStoredPopupContext(currentPopupUid).notBackToPreviousPath) {
|
|
||||||
navigate(-1);
|
|
||||||
} else {
|
|
||||||
navigate(withSearchParams(removeLastPopupPath(location.pathname)));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[isPopupVisibleControlledByURL, setVisibleFromAction, navigate, location?.pathname],
|
[isPopupVisibleControlledByURL, setVisibleFromAction, navigate, location?.pathname],
|
||||||
);
|
);
|
||||||
|
@ -33,7 +33,6 @@ function cacheSchema(collectionNameList: string[]) {
|
|||||||
storePopupContext(workflowTodoViewActionSchema['x-uid'], {
|
storePopupContext(workflowTodoViewActionSchema['x-uid'], {
|
||||||
schema: workflowTodoViewActionSchema,
|
schema: workflowTodoViewActionSchema,
|
||||||
...workflowTodoViewActionSchema['x-action-context'],
|
...workflowTodoViewActionSchema['x-action-context'],
|
||||||
notBackToPreviousPath: true,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user