Commit graph

55 commits

Author SHA1 Message Date
Danila Fedorin
0466b49520 Rename MappedList to TypeScript 2021-10-03 22:18:12 -07:00
Danila Fedorin
3b131f2db6 Add type annotations to ConcatList 2021-10-03 22:18:12 -07:00
Danila Fedorin
588da9b719 Relax types on BaseObservableList and add helper for tests 2021-10-03 22:18:12 -07:00
Danila Fedorin
ddca467e30 Rename ConcatList to TypeScript 2021-10-03 22:18:12 -07:00
Danila Fedorin
8466a910da Add type annotations to AsyncMappedList 2021-10-03 22:18:12 -07:00
Danila Fedorin
0e6c59983f Generalize BaseMappedList to allow mappers to promises 2021-10-03 22:18:10 -07:00
Danila Fedorin
e6de873b6e Rename AsyncMappedList to TypeScript 2021-10-03 22:16:46 -07:00
Danila Fedorin
b148f3ca9e Add type annotations to ObservableArray 2021-10-03 22:16:46 -07:00
Danila Fedorin
348a9c83f5 Rename ObservableArray to TypeScript 2021-10-03 22:16:46 -07:00
Bruno Windels
3de3481765 prefer optional syntax over '| null' 2021-10-01 10:05:56 +02:00
Danila Fedorin
c80dfb10a2 Add type annotations to BaseMappedList 2021-09-29 18:41:30 -07:00
Danila Fedorin
99164eb0d8 Rename BaseMappedList to TypeScript 2021-09-29 18:17:38 -07:00
Danila Fedorin
bf53449f66 Add type annotations to common 2021-09-29 18:13:49 -07:00
Danila Fedorin
e53f3d23d5 Rename common to TypeScript 2021-09-29 18:10:09 -07:00
Danila Fedorin
414280ada9 Add type annotations to BaseObservableList 2021-09-29 18:05:30 -07:00
Danila Fedorin
3952c3b969 Rename BaseObservableList to TypeScript 2021-09-29 17:46:51 -07:00
Danila Fedorin
d73dea797a Rename BaseObservable to TypeScript 2021-09-29 17:18:22 -07:00
Bruno Windels
e125599a47 prevent decryption result getting lost after reaction updates entry 2021-06-23 17:38:52 +02:00
Bruno Windels
81f06f565e write tests for AsyncMappedList 2021-06-21 17:26:08 +02:00
Bruno Windels
757e08c62c WIP 4 2021-06-10 18:29:10 +02:00
Bruno Windels
addddf1f26 remove need for transferLocalEchoState, just add local relations again 2021-05-31 16:33:05 +02:00
Bruno Windels
0596ca06b1 emit remove before linking up sibling tiles
otherwise emitting the update from updatePreviousSibling has
the wrong idx
2021-05-31 11:56:41 +02:00
Bruno Windels
63b371b6ef support findAndUpdate with same predicate semantics in SortedArray too 2021-05-31 10:47:32 +02:00
Bruno Windels
fa37e8fedb findAndUpdate uses predicate, just add callback to update method 2021-05-31 10:46:16 +02:00
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
Bruno Windels
da02b5fe2d transfer local echo state when replacing event entry
e.g. after decryption or remote echo of other relation comes in
2021-05-26 13:10:19 +02:00
Bruno Windels
a5d5c55835 MappedList.findAndUpdate 2021-05-26 13:08:33 +02:00
Bruno Windels
4ce66fc8a1 allow concurrent removals when iterating pending events
so we can remove failed events in the next commit
2021-05-20 14:51:04 +02:00
Bruno Windels
f976eeaf13 rename SortedArray.replace to update 2021-04-08 18:36:09 +02:00
Bruno Windels
4875095ea3 fix event tiles not updating when event is decrypted when room keys come 2020-09-11 17:47:35 +02:00
Bruno Windels
62bcb27784 implement decryption retrying and decrypting of gap/load entries
turns out we do have to always check for replay attacks because
failing to decrypt doesn't prevent an item from being stored,
so if you reload and then load you might be decrypting it
for the first time
2020-09-04 15:29:58 +02:00
Bruno Windels
00a85697ab add license header in all source files 2020-08-05 18:38:55 +02:00
Bruno Windels
c379caf4c0 remove obsolete ifdef comments 2020-04-20 21:31:27 +02:00
Bruno Windels
001dbefbcf stop using default exports
because it becomes hard to remember where you used them and where not
2020-04-20 21:26:39 +02:00
Bruno Windels
8c5411cb7d moar WIP 2020-04-19 19:02:10 +02:00
Bruno Windels
de35df10d8 fix test + bug in ConcatList update 2019-07-29 20:03:22 +02:00
Bruno Windels
b723ab4cef add failing test for ConcatList update 2019-07-29 20:03:06 +02:00
Bruno Windels
3b7ab8f1c8 fix MappedList test after passing params as well to updater 2019-07-29 20:02:42 +02:00
Bruno Windels
bfdff353b0 pass params in map operator update fn 2019-07-29 19:52:28 +02:00
Bruno Windels
7a6e91de84 concat operator for observable lists 2019-07-29 19:18:11 +02:00
Bruno Windels
6f650d19b1 map operator for observable lists 2019-07-29 19:17:55 +02:00
Bruno Windels
b26f7df689 pending events are not certain to be sorted here 2019-07-29 09:54:34 +02:00
Bruno Windels
ccb722d766 more WIP 2019-07-26 22:03:57 +02:00
Bruno Windels
f3d1128f28 WIP 2019-07-01 10:00:29 +02:00
Bruno Windels
e339cb7321 more fixes, timeline is showing again 2019-06-02 14:59:30 +02:00
Bruno Windels
a1e527ccbc first round of fixes after running the app again in the browser! 2019-06-02 00:49:47 +02:00
Bruno Windels
843c94b750 finished observable SortedArray to something useable
although not as performant as it could be
2019-06-01 17:38:23 +02:00
Bruno Windels
784588440c WIP for fragment support 2019-05-19 20:49:46 +02:00
Bruno Windels
8e8e22fe16 work on filling gaps 2019-03-09 00:41:06 +01:00
Bruno Windels
6940e14b18 move sortedIndex out of observable as other code will want to use it too 2019-03-08 20:04:28 +01:00