Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

### CI

* **pr-gate:** run vitest unit tests in the Required PR workflow ([dbea82a](https://github.com/iblai/os/commit/dbea82a2bf35529c6195fb8ab1b631d2b2b09ce4))
- **pr-gate:** run vitest unit tests in the Required PR workflow ([dbea82a](https://github.com/iblai/os/commit/dbea82a2bf35529c6195fb8ab1b631d2b2b09ce4))

## [0.95.6](https://github.com/iblai/os/compare/v0.95.5...v0.95.6) (2026-07-13)

### Documentation

* **readme:** link the macOS row to the latest build download ([238bc6d](https://github.com/iblai/os/commit/238bc6d16346989f0fc1f4a52542918f8c8bbab3)), closes [#download](https://github.com/iblai/os/issues/download)
- **readme:** link the macOS row to the latest build download ([238bc6d](https://github.com/iblai/os/commit/238bc6d16346989f0fc1f4a52542918f8c8bbab3)), closes [#download](https://github.com/iblai/os/issues/download)

## [0.95.5](https://github.com/iblai/os/compare/v0.95.4...v0.95.5) (2026-07-13)

Expand Down
19 changes: 19 additions & 0 deletions providers/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,25 @@ describe('Providers', () => {
expect(mockPush).toHaveBeenCalledWith('/platform/t1/m1');
});

it('redirectToMentor is a no-op when already on the target mentor (keeps query params)', () => {
// Simulates the SDK re-invoking redirectToMentor after the initial
// redirect has already landed on the mentor page with its query string.
const locationSpy = vi.spyOn(window, 'location', 'get').mockReturnValue({
...window.location,
pathname: '/platform/t1/m1',
search: '?embed=true&mode=anonymous&component=chat',
} as Location);
try {
renderProviders();
const fn = capturedMentorProviderProps.redirectToMentor as Function;
fn('t1', 'm1');
// No re-navigation — the existing URL (with its query params) is kept.
expect(mockPush).not.toHaveBeenCalledWith('/platform/t1/m1');
} finally {
locationSpy.mockRestore();
}
});

it('redirectToAuthSpa calls the real function', () => {
renderProviders();
const fn = capturedMentorProviderProps.redirectToAuthSpa as Function;
Expand Down
8 changes: 7 additions & 1 deletion providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,17 @@ export default function Providers({ children }: { children: React.ReactNode }) {
}

function redirectToMentor(tenantKey: string, mentorId: string) {
const targetPath = `/platform/${tenantKey}/${mentorId}`;
// The SDK MentorProvider re-invokes this after the initial `/` → mentor
// redirect settles. Bail out when we're already on the target mentor,
// otherwise the re-invocation re-pushes a bare URL and strips the current
// query string (e.g. embed/mode/component params).
if (window.location.pathname === targetPath) return;
let queryParams = '';
if (window.location.pathname === '/') {
queryParams = window.location.search;
}
router.push(`/platform/${tenantKey}/${mentorId}${queryParams}`);
router.push(`${targetPath}${queryParams}`);
}

function onLoadMentorsPermissions(
Expand Down
Loading