Fix new messages button, improve room load
This commit is contained in:
parent
e8ed9cd379
commit
2fd7556a52
3 changed files with 8 additions and 11 deletions
|
|
@ -22,6 +22,7 @@ import {
|
|||
getAddress,
|
||||
isShareableRelayUrl,
|
||||
getRelaysFromList,
|
||||
sortEventsDesc,
|
||||
} from "@welshman/util"
|
||||
import type {TrustedEvent, Filter, List} from "@welshman/util"
|
||||
import {load, request} from "@welshman/net"
|
||||
|
|
@ -51,7 +52,7 @@ export const makeFeed = ({
|
|||
const events = writable<TrustedEvent[]>([])
|
||||
|
||||
let interval = int(WEEK)
|
||||
let buffer: TrustedEvent[] = []
|
||||
let buffer = sortEventsDesc(getEventsForUrl(url, filters))
|
||||
let backwardWindow = [at - interval, at]
|
||||
let forwardWindow = [at, at + interval]
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ export const makeFeed = ({
|
|||
|
||||
backwardWindow = [since - interval, since]
|
||||
|
||||
for (const event of buffer.splice(0)) {
|
||||
for (const event of buffer.splice(0, 30)) {
|
||||
insertEvent(event)
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +160,7 @@ export const makeFeed = ({
|
|||
|
||||
forwardWindow = [until, until + interval]
|
||||
|
||||
for (const event of buffer.splice(0)) {
|
||||
for (const event of buffer.splice(0, 30)) {
|
||||
insertEvent(event)
|
||||
}
|
||||
|
||||
|
|
@ -172,10 +173,6 @@ export const makeFeed = ({
|
|||
},
|
||||
})
|
||||
|
||||
for (const event of getEventsForUrl(url, filters)) {
|
||||
insertEvent(event)
|
||||
}
|
||||
|
||||
return {
|
||||
events,
|
||||
cleanup: () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import {onMount, tick} from "svelte"
|
||||
import {onMount} from "svelte"
|
||||
import {readable} from "svelte/store"
|
||||
import {page} from "$app/stores"
|
||||
import {goto} from "$app/navigation"
|
||||
|
|
@ -301,7 +301,7 @@
|
|||
|
||||
elements.reverse()
|
||||
|
||||
tick().then(manageScrollPosition)
|
||||
requestAnimationFrame(manageScrollPosition)
|
||||
|
||||
return elements
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import {onMount, tick} from "svelte"
|
||||
import {onMount} from "svelte"
|
||||
import {page} from "$app/stores"
|
||||
import {goto} from "$app/navigation"
|
||||
import type {Readable} from "svelte/store"
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
|
||||
elements.reverse()
|
||||
|
||||
tick().then(manageScrollPosition)
|
||||
requestAnimationFrame(manageScrollPosition)
|
||||
|
||||
return elements
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue