Skip to content

Commit

Permalink
refactor: defensive check
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaaa committed Apr 30, 2024
1 parent f00f16d commit 0859b84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/store-sync/src/createStoreSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { bigIntMax, chunk, isDefined, waitForIdle } from "@latticexyz/common/uti
import { getSnapshot } from "./getSnapshot";
import { fetchAndStoreLogs } from "./fetchAndStoreLogs";
import { Store as StoreConfig } from "@latticexyz/store";
import { MUDChain } from "@latticexyz/common/chains";

const debug = parentDebug.extend("createStoreSync");

Expand Down Expand Up @@ -97,7 +96,11 @@ export async function createStoreSync<config extends StoreConfig = StoreConfig>(
filters,
initialState,
initialBlockLogs,
indexerUrl: indexerUrl ?? (publicClient.chain as MUDChain).indexerUrl,
indexerUrl:
indexerUrl ??
(publicClient.chain && "indexerUrl" in publicClient.chain && typeof publicClient.chain.indexerUrl === "string"
? publicClient.chain.indexerUrl
: undefined),
});

onProgress?.({
Expand Down

0 comments on commit 0859b84

Please sign in to comment.