From 3a8f5809319fc57859a58a4b6b25125e52b805cc Mon Sep 17 00:00:00 2001 From: Fraser Scott Date: Tue, 30 Apr 2024 15:28:17 +0100 Subject: [PATCH] refactor indexer url can be false --- packages/store-sync/src/common.ts | 2 +- packages/store-sync/src/createStoreSync.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/store-sync/src/common.ts b/packages/store-sync/src/common.ts index 72ccd53248..6d9c2a0eb8 100644 --- a/packages/store-sync/src/common.ts +++ b/packages/store-sync/src/common.ts @@ -95,7 +95,7 @@ export type SyncOptions = { /** * Optional MUD tRPC indexer URL to fetch initial state from. */ - indexerUrl?: string; + indexerUrl?: string | false; /** * Optional initial state to hydrate from. Useful if you're hydrating from an indexer or cache. * @deprecated Use `initialLogs` option instead. diff --git a/packages/store-sync/src/createStoreSync.ts b/packages/store-sync/src/createStoreSync.ts index 36ed9ae862..a359d8d813 100644 --- a/packages/store-sync/src/createStoreSync.ts +++ b/packages/store-sync/src/createStoreSync.ts @@ -97,10 +97,14 @@ export async function createStoreSync( initialState, initialBlockLogs, indexerUrl: - indexerUrl ?? - (publicClient.chain && "indexerUrl" in publicClient.chain && typeof publicClient.chain.indexerUrl === "string" - ? publicClient.chain.indexerUrl - : undefined), + indexerUrl !== false + ? indexerUrl ?? + (publicClient.chain && + "indexerUrl" in publicClient.chain && + typeof publicClient.chain.indexerUrl === "string" + ? publicClient.chain.indexerUrl + : undefined) + : undefined, }); onProgress?.({