Skip to content

Commit

Permalink
chore: remove unnecessary helper from namespace sync state (#850)
Browse files Browse the repository at this point in the history
This change should have no user impact.

`createState()` is never called with an argument, so we can remove the
function and inline it.
  • Loading branch information
EvanHahn authored Sep 19, 2024
1 parent 3a084a8 commit 463ef73
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions src/sync/namespace-sync-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 463ef73

Please sign in to comment.