New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #3665 - Refactor timelines reducer #3686
Conversation
All types of timelines now have a flat structure and use the same reducer functions and actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good.
@beatrix-bitrot I will ask you to check with the production:smile: |
I found some warnings on Chrome 58 console:
Also this patch brings back account timeline issue #3447. Second fetching (with since_id) may not return next link, so it prevents load more if save that result to the state. |
@unarist |
@Gargron
Did you checked the issue I mentioned is not reproduced with this patch? |
@unarist You are right. Perhaps |
actions/timelines.js: export function updateTimeline(timeline, status) {
return (dispatch, getState) => {
const references = status.reblog ? getState().get('statuses').filter((item, itemId) => (itemId === status.reblog.id || item.get('reblog') === status.reblog.id)).map((_, itemId) => itemId) : [];
And in
It should be |
Oh wait! The problem is only because hasMore blocks the loading of more stuff, right? |
@Gargron |
Right. Well, maybe |
@unarist Ah, I was thinking of a slightly different scenario. Same bug currently occurs in notification column too:
Expected: It will load the posts after the last visible one, without gaps So I think that the usage of "next" in the timelines specifically should be removed, and hasMore should always be true. |
We shouldn't make hasMore always true, because it allows the user loading more statuses infinitely (#2066). Also timelines may have "end" especially on remote account timeline. So I've changed Well, maybe we should store boolean value for |
@unarist Okay, I think my last commit should take care of the issue. I think I had just accidentally removed the fix that was already there, i.e. only set "next" if previous "next" wasn't set in refreshTimeline (that's the since_id case) I also found that there was a typo in expandNotifications, which had been there for a long time, and fixed that too. |
@@ -124,10 +124,9 @@ export function refreshNotificationsFail(error, skipLoading) { | |||
|
|||
export function expandNotifications() { | |||
return (dispatch, getState) => { | |||
const url = getState().getIn(['notifications', 'next'], null); | |||
const lastId = getState().getIn(['notifications', 'items']).last(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, lastId
is whole entity, not id...
@unarist Yes. notifications stop doing load more... |
I found glitch reported by beatrix on Discord exists.
|
@clworld @beatrix-bitrot @unarist Okay, fixed! |
* Move ancestors/descendants out of timelines reducer * Refactor timelines reducer All types of timelines now have a flat structure and use the same reducer functions and actions * Reintroduce some missing behaviours * Fix wrong import in reports * Fix includes typo * Fix issue related to "next" pagination in timelines and notifications * Fix bug with timeline's initial state, expandNotifications
Fix #3665
Before:
After:
Previously they all had different action creators and action signatures, e.g.
FETCH_ACCOUNT_TIMELINE_SUCCESS
specifically, etc. They also had special treatment in the reducer, with slightly different functions to handle each action. Also, there could be only one tag timeline, loading a new hashtag replaced the previous one.Now everything is using the same action creators (with convenience curries) and the same action signatures e.g.
TIMELINE_REFRESH_SUCCESS
, and different hashtags can co-exist in the same world.