From 72efcada651aa20432e201cbd95d769bbab5bbe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 20 Oct 2024 13:22:50 +0200 Subject: [PATCH] pl-fe: Remove unused action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/actions/sw.ts | 16 ---------------- packages/pl-fe/src/reducers/meta.test.ts | 9 --------- packages/pl-fe/src/reducers/meta.ts | 7 +------ 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 packages/pl-fe/src/actions/sw.ts diff --git a/packages/pl-fe/src/actions/sw.ts b/packages/pl-fe/src/actions/sw.ts deleted file mode 100644 index 346864bda..000000000 --- a/packages/pl-fe/src/actions/sw.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** Sets the ServiceWorker updating state. */ -const SW_UPDATING = 'SW_UPDATING' as const; - -/** Dispatch when the ServiceWorker is being updated to display a loading screen. */ -const setSwUpdating = (isUpdating: boolean) => ({ - type: SW_UPDATING, - isUpdating, -}); - -type SwAction = ReturnType; - -export { - SW_UPDATING, - setSwUpdating, - type SwAction, -}; diff --git a/packages/pl-fe/src/reducers/meta.test.ts b/packages/pl-fe/src/reducers/meta.test.ts index ea1bd08b9..93ddc40ee 100644 --- a/packages/pl-fe/src/reducers/meta.test.ts +++ b/packages/pl-fe/src/reducers/meta.test.ts @@ -1,7 +1,5 @@ import { Record as ImmutableRecord } from 'immutable'; -import { SW_UPDATING, setSwUpdating } from 'pl-fe/actions/sw'; - import reducer from './meta'; describe('meta reducer', () => { @@ -11,11 +9,4 @@ describe('meta reducer', () => { expect(result.instance_fetch_failed).toBe(false); expect(result.swUpdating).toBe(false); }); - - describe(SW_UPDATING, () => { - it('sets swUpdating to the provided value', () => { - const result = reducer(undefined, setSwUpdating(true)); - expect(result.swUpdating).toBe(true); - }); - }); }); diff --git a/packages/pl-fe/src/reducers/meta.ts b/packages/pl-fe/src/reducers/meta.ts index c3493fdfb..5c7238c4a 100644 --- a/packages/pl-fe/src/reducers/meta.ts +++ b/packages/pl-fe/src/reducers/meta.ts @@ -1,24 +1,19 @@ import { Record as ImmutableRecord } from 'immutable'; import { INSTANCE_FETCH_FAIL, type InstanceAction } from 'pl-fe/actions/instance'; -import { SW_UPDATING, type SwAction } from 'pl-fe/actions/sw'; const ReducerRecord = ImmutableRecord({ /** Whether /api/v1/instance 404'd (and we should display the external auth form). */ instance_fetch_failed: false, - /** Whether the ServiceWorker is currently updating (and we should display a loading screen). */ - swUpdating: false, }); -const meta = (state = ReducerRecord(), action: InstanceAction | SwAction) => { +const meta = (state = ReducerRecord(), action: InstanceAction) => { switch (action.type) { case INSTANCE_FETCH_FAIL: if (action.error?.response?.status === 404) { return state.set('instance_fetch_failed', true); } return state; - case SW_UPDATING: - return state.set('swUpdating', action.isUpdating); default: return state; }