re-instantiating state for posts update as an experiment

This commit is contained in:
Nouman Tahir 2021-04-06 01:15:46 +05:00
parent 13d031c563
commit f68cb455db

View File

@ -157,27 +157,20 @@ export const cacheReducer = (state:PostsCache, action) => {
}
//update stat
const data = Object.create(state.cachedData);
data[filter] = {
...cachedEntry,
startAuthor : _posts[_posts.length - 1] && _posts[_posts.length - 1].author,
startPermlink : _posts[_posts.length - 1] && _posts[_posts.length - 1].permlink,
posts : _posts,
}
// cachedEntry.startAuthor = _posts[_posts.length - 1] && _posts[_posts.length - 1].author;
// cachedEntry.startPermlink = _posts[_posts.length - 1] && _posts[_posts.length - 1].permlink;
// cachedEntry.posts = _posts;
// state.cachedData[filter] = cachedEntry;
cachedEntry.startAuthor = _posts[_posts.length - 1] && _posts[_posts.length - 1].author;
cachedEntry.startPermlink = _posts[_posts.length - 1] && _posts[_posts.length - 1].permlink;
cachedEntry.posts = _posts;
state.cachedData[filter] = cachedEntry;
state.cachedData = data
//dispatch to redux
// if (
// filter === (state.selectedFilter !== 'feed' ? state.selectedFilter : state.currentSubFilter)
// ) {
// _setFeedPosts(_posts);
// }
return state;
return Object.create(state);
}
case CacheActions.RESET_CURRENT_FILTER_CACHE: {