Fix public timelines being broken by new toots when they are not mounted (#10131)
This commit is contained in:
parent
09c042aa10
commit
be1c634b2b
5 changed files with 28 additions and 7 deletions
|
@ -6,6 +6,7 @@ import {
|
|||
TIMELINE_EXPAND_REQUEST,
|
||||
TIMELINE_EXPAND_FAIL,
|
||||
TIMELINE_SCROLL_TOP,
|
||||
TIMELINE_CONNECT,
|
||||
TIMELINE_DISCONNECT,
|
||||
} from '../actions/timelines';
|
||||
import {
|
||||
|
@ -20,6 +21,7 @@ const initialState = ImmutableMap();
|
|||
|
||||
const initialTimeline = ImmutableMap({
|
||||
unread: 0,
|
||||
online: false,
|
||||
top: true,
|
||||
isLoading: false,
|
||||
hasMore: true,
|
||||
|
@ -142,14 +144,13 @@ export default function timelines(state = initialState, action) {
|
|||
return filterTimeline('home', state, action.relationship, action.statuses);
|
||||
case TIMELINE_SCROLL_TOP:
|
||||
return updateTop(state, action.timeline, action.top);
|
||||
case TIMELINE_CONNECT:
|
||||
return state.update(action.timeline, initialTimeline, map => map.set('online', true));
|
||||
case TIMELINE_DISCONNECT:
|
||||
return state.update(
|
||||
action.timeline,
|
||||
initialTimeline,
|
||||
map => map.update(
|
||||
'items',
|
||||
items => items.first() ? items.unshift(null) : items
|
||||
)
|
||||
map => map.set('online', false).update('items', items => items.first() ? items.unshift(null) : items)
|
||||
);
|
||||
default:
|
||||
return state;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue