Skip to content

Commit

Permalink
Fix loading searches (and change sync token name to invalidate saved …
Browse files Browse the repository at this point in the history
…tokens)
  • Loading branch information
bhollis committed Jan 28, 2025
1 parent 5c76e82 commit 60bcb95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/dim-api/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function loadDimApiData(
try {
const syncToken =
currentAccount && $featureFlags.dimApiSync && !forceLoad
? getState().dimApi.profiles?.[makeProfileKeyFromAccount(currentAccount)]?.syncToken
? getState().dimApi.profiles?.[makeProfileKeyFromAccount(currentAccount)]?.sync
: undefined;
const profileResponse = await getDimApiProfile(currentAccount, syncToken);
dispatch(profileLoaded({ profileResponse, account: currentAccount }));
Expand Down
6 changes: 4 additions & 2 deletions src/app/dim-api/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface DimApiState {
triumphs: number[];

/** This allows us to get just the items that changed from the DIM API instead of the whole deal. */
syncToken?: string;
sync?: string;
};
};

Expand Down Expand Up @@ -421,6 +421,8 @@ function profileLoaded(
);
if (foundSearchIndex >= 0) {
newSearches[foundSearchIndex] = search;
} else {
newSearches.push(search);
}
}
for (const searchHash of profileResponse.deletedSearchHashes ?? []) {
Expand Down Expand Up @@ -467,7 +469,7 @@ function profileLoaded(
loadouts: newLoadouts,
tags: newTags,
triumphs: [...newTriumphs],
syncToken: profileResponse.syncToken,
sync: profileResponse.syncToken,
},
};
}
Expand Down

0 comments on commit 60bcb95

Please sign in to comment.