mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
19 lines
570 B
TypeScript
19 lines
570 B
TypeScript
|
|
export type CompanySelectionSource = "manual" | "route_sync" | "bootstrap";
|
||
|
|
|
||
|
|
export function shouldSyncCompanySelectionFromRoute(params: {
|
||
|
|
selectionSource: CompanySelectionSource;
|
||
|
|
selectedCompanyId: string | null;
|
||
|
|
routeCompanyId: string;
|
||
|
|
}): boolean {
|
||
|
|
const { selectionSource, selectedCompanyId, routeCompanyId } = params;
|
||
|
|
|
||
|
|
if (selectedCompanyId === routeCompanyId) return false;
|
||
|
|
|
||
|
|
// Let manual company switches finish their remembered-path navigation first.
|
||
|
|
if (selectionSource === "manual" && selectedCompanyId) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
return true;
|
||
|
|
}
|