Remove duplicate page-id bridge API
- keep getCurrentPageId off the legacy shell bridge surface - leave page-id lookup on the router side where it is actually used - align the bridge tests and type definitions with the slimmer API
This commit is contained in:
parent
ed2b8d0e3d
commit
82115011b2
6 changed files with 0 additions and 12 deletions
|
|
@ -54,7 +54,6 @@ function mockIssuesFetch() {
|
|||
|
||||
function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge {
|
||||
return {
|
||||
getCurrentPageId: vi.fn<() => ShellPageId>(() => 'dashboard'),
|
||||
getCurrentProfileContext: vi.fn(() => ({ profileId: 1, isAdmin: false })),
|
||||
isPageAllowed: vi.fn(() => true),
|
||||
getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'),
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ describe('waitForShellContext', () => {
|
|||
getProfileHomePage: vi.fn(() => 'discover'),
|
||||
isPageAllowed: vi.fn(() => true),
|
||||
activateLegacyPath: vi.fn(),
|
||||
getCurrentPageId: vi.fn(() => 'issues'),
|
||||
getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })),
|
||||
resolveLegacyPath: vi.fn(() => 'issues'),
|
||||
setActivePageChrome: vi.fn(),
|
||||
|
|
@ -36,7 +35,6 @@ describe('waitForShellContext', () => {
|
|||
getProfileHomePage: vi.fn(() => 'discover'),
|
||||
isPageAllowed: vi.fn(() => true),
|
||||
activateLegacyPath: vi.fn(),
|
||||
getCurrentPageId: vi.fn(() => 'issues'),
|
||||
getCurrentProfileContext,
|
||||
resolveLegacyPath: vi.fn(() => 'issues'),
|
||||
setActivePageChrome: vi.fn(),
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@ export async function waitForShellContext(): Promise<ShellContext> {
|
|||
export function bindWindowWebRouter(router: AnyRouter) {
|
||||
window.SoulSyncWebRouter = {
|
||||
routeManifest: [...shellRouteManifest],
|
||||
getCurrentPageId() {
|
||||
return resolveShellPageFromPath(window.location.pathname);
|
||||
},
|
||||
getCurrentPath() {
|
||||
return normalizeShellPath(window.location.pathname);
|
||||
},
|
||||
|
|
|
|||
2
webui/src/platform/shell/globals.d.ts
vendored
2
webui/src/platform/shell/globals.d.ts
vendored
|
|
@ -17,7 +17,6 @@ declare global {
|
|||
};
|
||||
SoulSyncWebRouter?: {
|
||||
routeManifest: ShellRouteDefinition[];
|
||||
getCurrentPageId: () => ShellPageId | null;
|
||||
getCurrentPath: () => string;
|
||||
resolvePageId: (pathname: string) => ShellPageId | null;
|
||||
navigateToPage: (
|
||||
|
|
@ -28,7 +27,6 @@ declare global {
|
|||
) => Promise<boolean>;
|
||||
};
|
||||
SoulSyncWebShellBridge?: {
|
||||
getCurrentPageId: () => ShellPageId;
|
||||
getCurrentProfileContext: () => ShellProfileContext | null;
|
||||
isPageAllowed: (pageId: ShellPageId) => boolean;
|
||||
getProfileHomePage: () => ShellPageId;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ function createResponse(body: unknown, ok = true, status = 200) {
|
|||
|
||||
function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge {
|
||||
return {
|
||||
getCurrentPageId: vi.fn<() => ShellPageId>(() => 'issues'),
|
||||
getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })),
|
||||
isPageAllowed: vi.fn(() => true),
|
||||
getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'),
|
||||
|
|
|
|||
|
|
@ -124,9 +124,6 @@ window.SoulSyncWorkflowActions = {
|
|||
};
|
||||
|
||||
window.SoulSyncWebShellBridge = {
|
||||
getCurrentPageId() {
|
||||
return currentPage || getWebRouter()?.resolvePageId?.(window.location.pathname) || _getPageFromPath();
|
||||
},
|
||||
getCurrentProfileContext() {
|
||||
if (!currentProfile) return null;
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue