更新已收藏的在线列表时,将始终重新加载,不再使用缓存

This commit is contained in:
lyswhut 2022-01-18 15:44:27 +08:00
parent a4c5ecb5d7
commit 8fde559e8c
5 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,7 @@
### 优化 ### 优化
- 优化通知栏的更新机制,尝试修复魅族的通知栏图片不显示的问题 - 优化通知栏的更新机制,尝试修复魅族的通知栏图片不显示的问题
- 我的列表-列表名的右击菜单更新已收藏的在线列表时将始终重新加载不再使用缓存解决在原平台更新歌单后在LX点击更新可能看到的还是在原平台更新前的歌单的问题
### 修复 ### 修复

View File

@ -224,9 +224,9 @@ const List = memo(({ setVisiblePanel, currentList, handleCancelMultiSelect }) =>
let promise let promise
if (/board__/.test(sourceListId)) { if (/board__/.test(sourceListId)) {
const id = sourceListId.replace(/board__/, '') const id = sourceListId.replace(/board__/, '')
promise = getBoardListAll(id) promise = getBoardListAll({ id, isRefresh: true })
} else { } else {
promise = getListDetailAll({ source, id: sourceListId }) promise = getListDetailAll({ source, id: sourceListId, isRefresh: true })
} }
return promise.finally(() => { return promise.finally(() => {
setFetchingListStatus(fetchingListStatus => ({ ...fetchingListStatus, [id]: false })) setFetchingListStatus(fetchingListStatus => ({ ...fetchingListStatus, [id]: false }))

View File

@ -51,7 +51,7 @@ const BoardMenu = ({ visible, buttonPosition, index, hideMenu }) => {
hideMenu() hideMenu()
if (action) { if (action) {
const board = boards[sourceId][index] const board = boards[sourceId][index]
getListAll(board.id).then(list => { getListAll({ id: board.id }).then(list => {
if (!list.length) return if (!list.length) return
switch (action) { switch (action) {

View File

@ -138,8 +138,9 @@ export const getListDetail = ({ id, page, isRefresh = false }) => (dispatch, get
}) })
} }
export const getListDetailAll = ({ source, id }) => (dispatch, getState) => { export const getListDetailAll = ({ source, id, isRefresh = false }) => (dispatch, getState) => {
let listKey = `sdetail__${source}__${id}` let listKey = `sdetail__${source}__${id}`
if (isRefresh && cache.has(listKey)) cache.delete(listKey)
if (!cache.has(listKey)) cache.set(listKey, new Map()) if (!cache.has(listKey)) cache.set(listKey, new Map())
const listCache = cache.get(listKey) const listCache = cache.get(listKey)
const loadData = (id, page) => { const loadData = (id, page) => {

View File

@ -102,10 +102,11 @@ export const getList = ({ page, isRefresh = false }) => (dispatch, getState) =>
}) })
} }
export const getListAll = tabId => (dispatch, getState) => { export const getListAll = ({ id: tabId, isRefresh = false }) => (dispatch, getState) => {
// console.log(tabId) // console.log(tabId)
const [source, bangId] = tabId.split('__') const [source, bangId] = tabId.split('__')
const listKey = `${source}__${tabId}` const listKey = `${source}__${tabId}`
if (isRefresh && cache.has(listKey)) cache.delete(listKey)
if (!cache.has(listKey)) cache.set(listKey, new Map()) if (!cache.has(listKey)) cache.set(listKey, new Map())
const listCache = cache.get(listKey) const listCache = cache.get(listKey)
const loadData = (bangId, page) => { const loadData = (bangId, page) => {