No description
Find a file
Bruno Windels c6e2607f1f guard against updates emitted while populating during first subscription
This came up now because Timeline uses a MappedList to map PendingEvents
to PendingEventEntries. In the map function, we setup links between
entries to support local echo for relations. When opening a timeline
that has unsent relations, the initial populating of the MappedList
will try to emit an update for the target entry in remoteEntries.
This all happens while the ListView of the timeline is calling subscribe
and all collections in the chain are populating themselves based on
their sources.

This usually entails calling subscribe on the source,
and now you are subscribed, iterate over the source (as you're not
allowed to query an unsubscribed observable collection, as it might not
be populated yet, and even if it did, it wouldn't be guaranteed to be
up to date as events aren't flowing yet).

So in this concrete example, TilesCollection hadn't populated its tiles
yet and when the update to the target of the unsent relation reached
TilesCollection, the tiles array was still null and it crashed.

I thought what would be the best way to fix this and have a solid model
for observable collections to ensure they are always compatible with
each other. I considered splitting up the subscription process in two
steps where you'd first populate the source and then explicitly start
events flowing.

I didn't go with this way because it's really only updates that
make sense to be emitted during setup.
A missed update wouldn't usually bring the collections out of sync
like a missed add or remove would. It would just mean the UI isn't
updated (or any subsequent filtered collections are not updated),
but this should be fine to ignore during setup, as you can rely
on the subscribing collections down the chain picking up the update
while populating. If we ever want to support add or remove events
during setup, we would have to explicitly support them, but for now
they are correct to throw.

So for now, just ignore update events that happen during setup
where needed.
2021-05-27 10:02:05 +02:00
.github/workflows rename workflow 2021-05-20 11:30:42 +02:00
assets Allow specifying a custom defaultHomeServer 2021-03-30 17:43:03 +01:00
doc some notes on how to implement relations 2021-05-19 12:01:58 +02:00
prototypes more prototypes 2021-03-08 14:17:31 +01:00
scripts Merge branch 'master' into feature/librejs 2021-04-28 20:22:20 +02:00
src guard against updates emitted while populating during first subscription 2021-05-27 10:02:05 +02:00
.dockerignore chore: optimise Dockerfile 2021-03-14 12:52:35 +01:00
.editorconfig wip 2019-02-17 23:58:01 +01:00
.eslintignore tune linting so it doesn't produce errors anymore and enable in CI 2021-05-20 11:11:57 +02:00
.eslintrc.js tune linting so it doesn't produce errors anymore and enable in CI 2021-05-20 11:11:57 +02:00
.gitignore tune linting so it doesn't produce errors anymore and enable in CI 2021-05-20 11:11:57 +02:00
.gitlab-ci.yml chore: add GitLab CI definition 2021-03-14 13:20:39 +01:00
codestyle.md notes on codestyle 2020-11-20 16:39:16 +01:00
Dockerfile chore: optimise Dockerfile 2021-03-14 12:52:35 +01:00
Dockerfile-dev chore: optimise Dockerfile 2021-03-14 12:52:35 +01:00
index.html Add to index.html 2021-03-31 17:01:49 +01:00
LICENSE add full license text 2020-08-05 18:40:45 +02:00
package.json tune linting so it doesn't produce errors anymore and enable in CI 2021-05-20 11:11:57 +02:00
README.md Ensured more subtleness in the readme file. 2021-04-30 13:40:10 +05:30
sw.js symlink service worker for local dev, so its scope captures whole app 2021-03-23 18:20:23 +01:00
TODO.md WIP 2020-08-05 18:17:35 +01:00
yarn.lock add eslint as dep, and have yarn lint run it 2021-05-17 12:53:58 +02:00

Hydrogen

A minimal Matrix chat client, focused on performance, offline functionality, and broad browser support. This is work in progress and not yet ready for primetime. Bug reports are welcome, but please don't file any feature requests or other missing things to be on par with Element Web.

Goals

Hydrogen's goals are:

  • Work well on desktop as well as mobile browsers
  • UI components can be easily used in isolation
  • It is a standalone webapp, but can also be easily embedded into an existing website/webapp to add chat capabilities.
  • Loading (unused) parts of the application after initial page load should be supported

If you find this interesting, come and discuss on #hydrogen:matrix.org.

How to use

Hydrogen is deployed to hydrogen.element.io. You can run it locally yarn install (only the first time) and yarn start in the terminal, and point your browser to http://localhost:3000. If you prefer, you can also use docker.

Hydrogen uses symbolic links in the codebase, so if you are on Windows, have a look at making git & symlinks work there.

FAQ

Some frequently asked questions are answered here.