opentower / populus-viewer

A Social Annotation Tool Powered by Matrix
https://opentower.github.io/populus-viewer
GNU Affero General Public License v3.0
120 stars 7 forks source link

Sync gives uncaught TypeError #123

Closed EdGeraghty closed 2 years ago

EdGeraghty commented 2 years ago

Trying to sync on https://opentower.github.io/populus-viewer/ gives me the following error:

Uncaught (in promise) TypeError: e.getLiveTimeline().getState(...).getStateEvents(...) is null

image

image

gleachkr commented 2 years ago

Thanks for the report!

I think I know where to catch this, but I'm a little puzzled as to how this error could arise in the first place. Could you describe your setup a little bit (what server you're connecting to, whether this is an account with any unusual preexisting rooms), so that I can see if there's any chance of reproducing this on my end?

gleachkr commented 2 years ago

Alright, I've got a hypothesis. I just deployed a possible fix - could you check to see if it helps?

EdGeraghty commented 2 years ago

It certainly seems to have! It syncs*!

I'm going to throw a rough guess that it's due to us switching on - and using - server-side retention... (If you want to contact me on Matrix, my contact details are on my profile)

If you're unable to reproduce the error on your side I can probably create you an "affected" account on my personal homeserver to play with.

*Though it's throwing Uncaught (in promise) TypeError: e.canonical_alias is undefined.

gleachkr commented 2 years ago

Great!

OK, I've tried to deploy a fix for the canonical_alias issue too.

The original issue seems to have been caused by the room (as pulled down by matrix-js-sdk sync) not having an available m.room.create event. Since both m.room.create and m.room.canonical_alias are early room state events, maybe these two things are related?

EdGeraghty commented 2 years ago

Thanks for your help, @gleachkr!

For those playing along at home, enabling server-side retention also seems to garbage collect required state messages.