From 70893b7e4c11b727dfa623b30d60f89bfa35b1b1 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 22 Dec 2020 23:52:59 -0500 Subject: [PATCH] Fixed issue with timeline, accounts being fetched with undefined/null id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed: - issue with timeline, accounts being fetched with undefined/null id --- app/javascript/gabsocial/actions/accounts.js | 1 + app/javascript/gabsocial/actions/timelines.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/javascript/gabsocial/actions/accounts.js b/app/javascript/gabsocial/actions/accounts.js index 702cc345..94c15457 100644 --- a/app/javascript/gabsocial/actions/accounts.js +++ b/app/javascript/gabsocial/actions/accounts.js @@ -97,6 +97,7 @@ function getFromDB(dispatch, getState, index, id) { */ export const fetchAccount = (id) => (dispatch, getState) => { if (id === -1 || getState().getIn(['accounts', id], null) !== null) return + if (!id) return dispatch(fetchRelationships([id])) dispatch(fetchAccountRequest(id)) diff --git a/app/javascript/gabsocial/actions/timelines.js b/app/javascript/gabsocial/actions/timelines.js index 57a4e48f..58e4e738 100644 --- a/app/javascript/gabsocial/actions/timelines.js +++ b/app/javascript/gabsocial/actions/timelines.js @@ -260,6 +260,8 @@ export const expandCommunityTimeline = ({ maxId, onlyMedia } = {}, done = noop) * */ export const expandAccountTimeline = (accountId, { maxId, withReplies, commentsOnly } = {}) => { + if (!accountId) return + let key = `account:${accountId}${withReplies ? ':with_replies' : ''}${commentsOnly ? ':comments_only' : ''}` return expandTimeline(key, `/api/v1/accounts/${accountId}/statuses`, { only_comments: commentsOnly,