Skip to content

Commit

Permalink
refactor indexer url can be false
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaaa committed Apr 30, 2024
1 parent 0859b84 commit 3a8f580
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/store-sync/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export type SyncOptions<config extends StoreConfig = StoreConfig> = {
/**
* 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.
Expand Down
12 changes: 8 additions & 4 deletions packages/store-sync/src/createStoreSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,14 @@ export async function createStoreSync<config extends StoreConfig = StoreConfig>(
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?.({
Expand Down

0 comments on commit 3a8f580

Please sign in to comment.