From 191962e2ef071555140018062026fedbada77c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Iv=C3=A1n=20Vieitez=20Parra?= <3857362+corrideat@users.noreply.github.com> Date: Wed, 8 Jan 2025 19:38:01 +0200 Subject: [PATCH] Closes #2465 (#2500) --- shared/domains/chelonia/chelonia.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shared/domains/chelonia/chelonia.js b/shared/domains/chelonia/chelonia.js index aa96b58ab..48231ac0f 100644 --- a/shared/domains/chelonia/chelonia.js +++ b/shared/domains/chelonia/chelonia.js @@ -339,7 +339,9 @@ export default (sbp('sbp/selectors/register', { postCleanupFn = newState newState = undefined } - sbp('chelonia/private/stopClockSync') + if (this.pubsub) { + sbp('chelonia/private/stopClockSync') + } // wait for any pending sync operations to finish before saving Object.keys(this.postSyncOperations).forEach(cID => { sbp('chelonia/private/enqueuePostSyncOps', cID) @@ -373,7 +375,9 @@ export default (sbp('sbp/selectors/register', { sbp('chelonia/clearTransientSecretKeys') sbp('okTurtles.events/emit', CHELONIA_RESET) sbp('okTurtles.events/emit', CONTRACTS_MODIFIED, Array.from(this.subscriptionSet), { added: [], removed: removedContractIDs }) - sbp('chelonia/private/startClockSync') + if (this.pubsub) { + sbp('chelonia/private/startClockSync') + } if (newState) { Object.entries(newState).forEach(([key, value]) => { this.config.reactiveSet(rootState, key, value) @@ -557,6 +561,9 @@ export default (sbp('sbp/selectors/register', { // its console output until we have a better solution. Do not use for auth. pubsubURL += `?debugID=${randomHexString(6)}` } + if (this.pubsub) { + sbp('chelonia/private/stopClockSync') + } sbp('chelonia/private/startClockSync') this.pubsub = createClient(pubsubURL, { ...this.config.connectionOptions,