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:
Antti Kettunen 2026-05-03 18:11:34 +03:00
parent ed2b8d0e3d
commit 82115011b2
No known key found for this signature in database
GPG key ID: C6B2A3D250359BD7
6 changed files with 0 additions and 12 deletions

View file

@ -54,7 +54,6 @@ function mockIssuesFetch() {
function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge { function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge {
return { return {
getCurrentPageId: vi.fn<() => ShellPageId>(() => 'dashboard'),
getCurrentProfileContext: vi.fn(() => ({ profileId: 1, isAdmin: false })), getCurrentProfileContext: vi.fn(() => ({ profileId: 1, isAdmin: false })),
isPageAllowed: vi.fn(() => true), isPageAllowed: vi.fn(() => true),
getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'), getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'),

View file

@ -14,7 +14,6 @@ describe('waitForShellContext', () => {
getProfileHomePage: vi.fn(() => 'discover'), getProfileHomePage: vi.fn(() => 'discover'),
isPageAllowed: vi.fn(() => true), isPageAllowed: vi.fn(() => true),
activateLegacyPath: vi.fn(), activateLegacyPath: vi.fn(),
getCurrentPageId: vi.fn(() => 'issues'),
getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })), getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })),
resolveLegacyPath: vi.fn(() => 'issues'), resolveLegacyPath: vi.fn(() => 'issues'),
setActivePageChrome: vi.fn(), setActivePageChrome: vi.fn(),
@ -36,7 +35,6 @@ describe('waitForShellContext', () => {
getProfileHomePage: vi.fn(() => 'discover'), getProfileHomePage: vi.fn(() => 'discover'),
isPageAllowed: vi.fn(() => true), isPageAllowed: vi.fn(() => true),
activateLegacyPath: vi.fn(), activateLegacyPath: vi.fn(),
getCurrentPageId: vi.fn(() => 'issues'),
getCurrentProfileContext, getCurrentProfileContext,
resolveLegacyPath: vi.fn(() => 'issues'), resolveLegacyPath: vi.fn(() => 'issues'),
setActivePageChrome: vi.fn(), setActivePageChrome: vi.fn(),

View file

@ -79,9 +79,6 @@ export async function waitForShellContext(): Promise<ShellContext> {
export function bindWindowWebRouter(router: AnyRouter) { export function bindWindowWebRouter(router: AnyRouter) {
window.SoulSyncWebRouter = { window.SoulSyncWebRouter = {
routeManifest: [...shellRouteManifest], routeManifest: [...shellRouteManifest],
getCurrentPageId() {
return resolveShellPageFromPath(window.location.pathname);
},
getCurrentPath() { getCurrentPath() {
return normalizeShellPath(window.location.pathname); return normalizeShellPath(window.location.pathname);
}, },

View file

@ -17,7 +17,6 @@ declare global {
}; };
SoulSyncWebRouter?: { SoulSyncWebRouter?: {
routeManifest: ShellRouteDefinition[]; routeManifest: ShellRouteDefinition[];
getCurrentPageId: () => ShellPageId | null;
getCurrentPath: () => string; getCurrentPath: () => string;
resolvePageId: (pathname: string) => ShellPageId | null; resolvePageId: (pathname: string) => ShellPageId | null;
navigateToPage: ( navigateToPage: (
@ -28,7 +27,6 @@ declare global {
) => Promise<boolean>; ) => Promise<boolean>;
}; };
SoulSyncWebShellBridge?: { SoulSyncWebShellBridge?: {
getCurrentPageId: () => ShellPageId;
getCurrentProfileContext: () => ShellProfileContext | null; getCurrentProfileContext: () => ShellProfileContext | null;
isPageAllowed: (pageId: ShellPageId) => boolean; isPageAllowed: (pageId: ShellPageId) => boolean;
getProfileHomePage: () => ShellPageId; getProfileHomePage: () => ShellPageId;

View file

@ -16,7 +16,6 @@ function createResponse(body: unknown, ok = true, status = 200) {
function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge { function createShellBridge(overrides: Partial<ShellBridge> = {}): ShellBridge {
return { return {
getCurrentPageId: vi.fn<() => ShellPageId>(() => 'issues'),
getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })), getCurrentProfileContext: vi.fn(() => ({ profileId: 2, isAdmin: true })),
isPageAllowed: vi.fn(() => true), isPageAllowed: vi.fn(() => true),
getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'), getProfileHomePage: vi.fn<() => ShellPageId>(() => 'discover'),

View file

@ -124,9 +124,6 @@ window.SoulSyncWorkflowActions = {
}; };
window.SoulSyncWebShellBridge = { window.SoulSyncWebShellBridge = {
getCurrentPageId() {
return currentPage || getWebRouter()?.resolvePageId?.(window.location.pathname) || _getPageFromPath();
},
getCurrentProfileContext() { getCurrentProfileContext() {
if (!currentProfile) return null; if (!currentProfile) return null;
return { return {