Skip to content

Commit

Permalink
[C-2975] Fix stale local data (#3915)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Aug 21, 2023
1 parent 748fdfd commit a3219c3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/common/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type UserMetadata = {
associated_wallets_balance?: Nullable<StringWei>
playlist_library?: PlaylistLibrary
userBank?: SolanaWalletAddress
local?: boolean
} & Timestamped

export type ComputedUserProperties = {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/store/cache/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const addEntries = (state: CacheState, entries: any[], replace?: boolean) => {
newEntries[entity.id] = wrapEntry(entity.metadata)
} else if (
existing &&
!existing.local &&
_timestamp + entryTTL > now &&
cacheType === 'fast'
) {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/store/cache/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type Metadata = {
blocknumber?: number
local?: boolean
}
2 changes: 1 addition & 1 deletion packages/web/src/common/store/account/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export function* fetchLocalAccountAsync() {
if (cachedAccount && cachedAccountUser && !cachedAccountUser.is_deactivated) {
yield call(
cacheAccount,
cachedAccountUser,
{ ...cachedAccountUser, local: true },
cachedAccountUser.orderedPlaylists
)
} else if (!currentUserExists) {
Expand Down

0 comments on commit a3219c3

Please sign in to comment.