mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
fix(login): keep the app sign-in screen within the eslint ratchets
Split the other ways in out of one component (complexity), finish the async handlers with void instead of handing promises to React, report a landscape that fails to load instead of logging it, let the handover wait on settled settings rather than catching them, and move the one-time code field's props into a module of their own so MfaCodeStep only exports its component.
This commit is contained in:
@@ -72,7 +72,6 @@ describe('appBoot', () => {
|
||||
|
||||
it('FE-NATIVE-APPBOOT-004: does not wait for settings that never come, nor stop on ones that fail', async () => {
|
||||
vi.useFakeTimers();
|
||||
vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
const hanging = vi.fn();
|
||||
void handOverToApp(new Promise(() => {}), hanging);
|
||||
await vi.advanceTimersByTimeAsync(1600);
|
||||
|
||||
@@ -42,10 +42,8 @@ const wait = (ms: number): Promise<void> => new Promise((resolve) => window.setT
|
||||
* the app, which rises in once its first screen is there (endAppBoot).
|
||||
*/
|
||||
export function handOverToApp(settings: Promise<unknown>, go: () => void): Promise<void> {
|
||||
const ready = Promise.race([settings, wait(SETTINGS_WAIT_MS)]).then(
|
||||
() => undefined,
|
||||
(err: unknown) => console.warn('Settings not ready for the handover:', err)
|
||||
);
|
||||
// allSettled: settings that fail to load must not hold the app back either.
|
||||
const ready = Promise.race([Promise.allSettled([settings]), wait(SETTINGS_WAIT_MS)]);
|
||||
return Promise.all([ready, wait(LEAVE_MS)]).then(() => {
|
||||
document.documentElement.setAttribute(HANDOVER, '');
|
||||
go();
|
||||
|
||||
Reference in New Issue
Block a user