diff options
author | ThibG <thib@sitedethib.com> | 2020-05-29 16:14:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 16:14:16 +0200 |
commit | 5aff2a6957e861162d67c4610277e9bb2a6f8186 (patch) | |
tree | 4538c14ca0428d99749c86a1634efd4263e490c8 /app/javascript/mastodon/actions/timelines.js | |
parent | 8bbc81c71e245c47a98b1de833557b38ad64a55d (diff) |
Fix timeline markers not working on Chrome (#13887)
* Periodically save timeline markers This saves timeline markers immediately upon message arrival, but not more than once every 5 minutes. This does not change how the markers are saved on closing the window, except that it avoids submitting them if there is no need for it. * Use the Fetch API when possible instead of XHR on window unload
Diffstat (limited to 'app/javascript/mastodon/actions/timelines.js')
-rw-r--r-- | app/javascript/mastodon/actions/timelines.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 00a7a6789..de1725acf 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -1,4 +1,5 @@ import { importFetchedStatus, importFetchedStatuses } from './importer'; +import { submitMarkers } from './markers'; import api, { getLinks } from 'mastodon/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import compareId from 'mastodon/compare_id'; @@ -36,6 +37,10 @@ export function updateTimeline(timeline, status, accept) { status, usePendingItems: preferPendingItems, }); + + if (timeline === 'home') { + dispatch(submitMarkers()); + } }; }; @@ -98,6 +103,10 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(importFetchedStatuses(response.data)); dispatch(expandTimelineSuccess(timelineId, response.data, next ? next.uri : null, response.status === 206, isLoadingRecent, isLoadingMore, isLoadingRecent && preferPendingItems)); + + if (timelineId === 'home') { + dispatch(submitMarkers()); + } }).catch(error => { dispatch(expandTimelineFail(timelineId, error, isLoadingMore)); }).finally(() => { |