diff --git a/routes/_components/Timeline.html b/routes/_components/Timeline.html
index 6b26fa3..c7c0c2f 100644
--- a/routes/_components/Timeline.html
+++ b/routes/_components/Timeline.html
@@ -1,5 +1,5 @@
<:Window bind:online />
-
+
@@ -23,7 +23,6 @@
import { mark, stop } from '../_utils/marks'
import { timelines } from '../_static/timelines'
-
const FETCH_LIMIT = 20
export default {
@@ -38,11 +37,13 @@
insertStatusesIntoDatabase(instanceName, this.get('timeline'), statuses)
}
this.addStatuses(statuses)
+ this.set({initialized: true})
},
data: () => ({
StatusListItem: StatusListItem,
statuses: [],
- runningUpdate: false
+ runningUpdate: false,
+ initialized: false
}),
computed: {
keyedStatuses: (statuses) => statuses.map(status => ({
@@ -60,10 +61,13 @@
splice: splice,
push: push,
async onScrollToBottom() {
- mark('onScrollToBottom')
+ if (!this.get('initialized')) {
+ return
+ }
if (this.get('runningUpdate')) {
return
}
+ mark('onScrollToBottom')
this.set({ runningUpdate: true })
let lastStatusId = this.get('lastStatusId')
let instanceName = this.store.get('currentInstance')
diff --git a/routes/_utils/serviceWorkerClient.js b/routes/_utils/serviceWorkerClient.js
index 31cb898..b2b85b1 100644
--- a/routes/_utils/serviceWorkerClient.js
+++ b/routes/_utils/serviceWorkerClient.js
@@ -1,16 +1,11 @@
import { toast } from './toast'
-import { keyval } from './database/keyval'
function onUpdateFound(registration) {
const newWorker = registration.installing
newWorker.addEventListener('statechange', async () => {
- if (!(await keyval.get('serviceworker_installed'))) {
- await keyval.set('serviceworker_installed', true)
- return
- }
- if (newWorker.state === 'activated' && navigator.serviceWorker.controller) {
- toast.say('App update available. Reload to update.')
+ if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
+ toast.say('Update available. Refresh to update.')
}
});
}