aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-09-02 22:12:50 +0300
committerShpuld Shpuldson <shp@cock.li>2020-09-02 22:12:50 +0300
commit5b403ba7d13eaf851ae43e814c583ceb018e2d20 (patch)
tree92d67057054be3579c5655fbaab0d2c7aa35fa8d /src
parent4d080a1654ff56e9875c49486457a1ac8e19297e (diff)
fix timeline showimmediately being set wrongly
Diffstat (limited to 'src')
-rw-r--r--src/services/fetcher/fetcher.js8
-rw-r--r--src/services/follow_request_fetcher/follow_request_fetcher.service.js1
-rw-r--r--src/services/notifications_fetcher/notifications_fetcher.service.js3
-rw-r--r--src/services/timeline_fetcher/timeline_fetcher.service.js3
4 files changed, 9 insertions, 6 deletions
diff --git a/src/services/fetcher/fetcher.js b/src/services/fetcher/fetcher.js
index 5a6ed4b8..aae1c2cc 100644
--- a/src/services/fetcher/fetcher.js
+++ b/src/services/fetcher/fetcher.js
@@ -1,9 +1,9 @@
// makeFetcher - replacement for setInterval for fetching, starts counting
// the interval only after a request is done instead of immediately.
-// promiseCall is a function that returns a promise, it's called when created
-// and after every interval.
-// interval is the interval delay in ms.
+// - promiseCall is a function that returns a promise, it's called the first
+// time after the first interval.
+// - interval is the interval delay in ms.
export const makeFetcher = (promiseCall, interval) => {
let stopped = false
@@ -22,7 +22,7 @@ export const makeFetcher = (promiseCall, interval) => {
window.clearTimeout(timeout)
}
- func()
+ timeout = window.setTimeout(func, interval)
return stopFetcher
}
diff --git a/src/services/follow_request_fetcher/follow_request_fetcher.service.js b/src/services/follow_request_fetcher/follow_request_fetcher.service.js
index 8d1aba7b..bec434aa 100644
--- a/src/services/follow_request_fetcher/follow_request_fetcher.service.js
+++ b/src/services/follow_request_fetcher/follow_request_fetcher.service.js
@@ -12,6 +12,7 @@ const fetchAndUpdate = ({ store, credentials }) => {
const startFetching = ({ credentials, store }) => {
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
+ boundFetchAndUpdate()
return makeFetcher(boundFetchAndUpdate, 10000)
}
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index c69d5b17..90988fc4 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -59,7 +59,8 @@ const startFetching = ({ credentials, store }) => {
// that there won't spam of them when user just opened up the FE we
// reset that flag after a while to show new notifications once again.
setTimeout(() => store.dispatch('setNotificationsSilence', false), 10000)
- const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store, refetch: true })
+ const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
+ boundFetchAndUpdate()
return makeFetcher(boundFetchAndUpdate, 10000)
}
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 8bbec2c7..9f585f68 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -71,8 +71,9 @@ const startFetching = ({ timeline = 'friends', credentials, store, userId = fals
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
const showImmediately = timelineData.visibleStatuses.length === 0
timelineData.userId = userId
+ fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag })
const boundFetchAndUpdate = () =>
- fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag })
+ fetchAndUpdate({ timeline, credentials, store, userId, tag })
return makeFetcher(boundFetchAndUpdate, 10000)
}
const timelineFetcher = {