mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 01:56:16 +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。'),
|
||||
).toBeVisible();
|
||||
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();
|
||||
|
@ -48,10 +48,6 @@ export interface PopupContextStorage extends PopupContext {
|
||||
/** used to refresh data for block */
|
||||
service?: any;
|
||||
sourceId?: string;
|
||||
/**
|
||||
* if true, will not back to the previous path when closing the popup
|
||||
*/
|
||||
notBackToPreviousPath?: boolean;
|
||||
}
|
||||
|
||||
const popupsContextStorage: Record<string, PopupContextStorage> = {};
|
||||
@ -279,14 +275,7 @@ export const usePopupUtils = (
|
||||
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;
|
||||
// 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)));
|
||||
}
|
||||
navigate(withSearchParams(removeLastPopupPath(location.pathname)), { replace: true });
|
||||
},
|
||||
[isPopupVisibleControlledByURL, setVisibleFromAction, navigate, location?.pathname],
|
||||
);
|
||||
|
@ -33,7 +33,6 @@ function cacheSchema(collectionNameList: string[]) {
|
||||
storePopupContext(workflowTodoViewActionSchema['x-uid'], {
|
||||
schema: workflowTodoViewActionSchema,
|
||||
...workflowTodoViewActionSchema['x-action-context'],
|
||||
notBackToPreviousPath: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user