Skip to content

Commit 19d1369

Browse files
committed
fix(page-load-saga): ensure restricted route persists and does not switch to login route on load complete
1 parent c28c5e1 commit 19d1369

File tree

2 files changed

+2
-38
lines changed

2 files changed

+2
-38
lines changed

src/store/page-load/saga.test.ts

-38
Original file line numberDiff line numberDiff line change
@@ -131,44 +131,6 @@ describe('page-load saga', () => {
131131
expect(history.replace).toHaveBeenCalledWith({ pathname: '/restricted' });
132132
expect(storeState.pageload.isComplete).toBe(true);
133133
});
134-
135-
describe('showAndroidDownload', () => {
136-
function subject(path: string, userAgent: string) {
137-
const initialState = { pageload: { showAndroidDownload: false } };
138-
return expectSaga(saga)
139-
.provide([
140-
[call(getHistory), new StubHistory(path)],
141-
[call(getCurrentUser), false],
142-
[call(getNavigator), stubNavigator(userAgent)],
143-
[spawn(redirectOnUserLogin), null],
144-
])
145-
.withReducer(rootReducer, initialState as any);
146-
}
147-
148-
it('is false if not on a configured page', async () => {
149-
const { storeState } = await subject('/', 'Android').run();
150-
151-
expect(storeState.pageload.showAndroidDownload).toBe(false);
152-
});
153-
154-
it('is false if not an android user agent', async () => {
155-
const { storeState } = await subject('/login', 'Chrome').run();
156-
157-
expect(storeState.pageload.showAndroidDownload).toBe(false);
158-
});
159-
160-
it('is true if the user agent matches and is login page', async () => {
161-
const { storeState } = await subject('/login', 'Android').run();
162-
163-
expect(storeState.pageload.showAndroidDownload).toBe(true);
164-
});
165-
166-
it('is true if the user agent matches and is get-access page', async () => {
167-
const { storeState } = await subject('/get-access', 'Android').run();
168-
169-
expect(storeState.pageload.showAndroidDownload).toBe(true);
170-
});
171-
});
172134
});
173135

174136
describe(redirectToEntryPath, () => {

src/store/page-load/saga.ts

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export function* saga() {
1717

1818
if (isMobileDevice) {
1919
history.replace({ pathname: '/restricted' });
20+
yield put(setIsComplete(true));
21+
return;
2022
}
2123

2224
const success = yield call(getCurrentUser);

0 commit comments

Comments
 (0)