Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[C-2975] Fix stale local data #3915

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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