From 463ef73fa10bb39cf7056f0af08de65be53e873d Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Thu, 19 Sep 2024 11:49:17 -0500 Subject: [PATCH] chore: remove unnecessary helper from namespace sync state (#850) This change should have no user impact. `createState()` is never called with an argument, so we can remove the function and inline it. --- src/sync/namespace-sync-state.js | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/sync/namespace-sync-state.js b/src/sync/namespace-sync-state.js index 42b171b46..8b3335bf5 100644 --- a/src/sync/namespace-sync-state.js +++ b/src/sync/namespace-sync-state.js @@ -62,7 +62,7 @@ export class NamespaceSyncState { const state = { dataToSync: false, coreCount: this.#coreCount, - localState: createState(), + localState: { want: 0, have: 0, wanted: 0 }, remoteStates: {}, } for (const css of this.#coreStates.values()) { @@ -133,28 +133,6 @@ export class NamespaceSyncState { } } -/** - * @overload - * @returns {SyncState['localState']} - */ - -/** - * @overload - * @param {import('./core-sync-state.js').PeerNamespaceState['status']} status - * @returns {import('./core-sync-state.js').PeerNamespaceState} - */ - -/** - * @param {import('./core-sync-state.js').PeerNamespaceState['status']} [status] - */ -export function createState(status) { - if (status) { - return { want: 0, have: 0, wanted: 0, status } - } else { - return { want: 0, have: 0, wanted: 0 } - } -} - /** * @overload * @param {SyncState['localState']} accumulator