Wait for events to load before saving scroll position
This commit is contained in:
		
							parent
							
								
									6227f6fa84
								
							
						
					
					
						commit
						c9dffc9d4a
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -373,7 +373,6 @@ class Timeline extends Subscribable {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	async loadScrollback() {
 | 
			
		||||
		this.broadcast("beforeScrollbackLoad")
 | 
			
		||||
		debug = true
 | 
			
		||||
		if (!this.from) throw new Error("Can't load scrollback, no from token")
 | 
			
		||||
		const url = new URL(`${lsm.get("domain")}/_matrix/client/r0/rooms/${this.id}/messages`)
 | 
			
		||||
| 
						 | 
				
			
			@ -385,7 +384,11 @@ class Timeline extends Subscribable {
 | 
			
		|||
			lazy_load_members: true
 | 
			
		||||
		}
 | 
			
		||||
		url.searchParams.set("filter", JSON.stringify(filter))
 | 
			
		||||
 | 
			
		||||
		const root = await fetch(url.toString()).then(res => res.json())
 | 
			
		||||
 | 
			
		||||
		this.broadcast("beforeScrollbackLoad")
 | 
			
		||||
 | 
			
		||||
		this.from = root.end
 | 
			
		||||
		//console.log(this.updateEvents, root.chunk)
 | 
			
		||||
		if (root.state) this.updateStateEvents(root.state)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue