Commit graph

14 commits

Author SHA1 Message Date
Bruno Windels 6d7c983e8e convert (Base)ObservableMap to typescript 2022-03-09 11:33:49 +01:00
Bruno Windels e105bc4237 fix lint warnings 2021-08-24 15:31:18 +02:00
RMidhunSuresh f41c835e91 Support updater in MappedMap
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
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 4e8e9eae26 first round of fixes 2020-10-12 18:31:55 +02:00
Bruno Windels 9a3734e5ba this is a NOP, but in the future might not be 2020-10-06 12:20:03 +02:00
Bruno Windels b814335b99 this was missing! and causing an error with empty lists 2020-08-21 19:21:53 +02:00
Bruno Windels fbf72b8825 bind key for spontaneous updates in MappedMap
so we just have to pass in the params
2020-08-12 17:38:40 +02:00
Bruno Windels 00a85697ab add license header in all source files 2020-08-05 18:38:55 +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 61804073e2 comment how updates should work 2019-03-15 20:29:17 +01:00
Bruno Windels 9e7811299d MappedMap update mechanism needs to be reworked, disable for now 2019-02-27 23:23:20 +01:00
Bruno Windels 6b4ed65a57 show timeline when clicking room in roomlist 2019-02-27 22:50:08 +01:00
Bruno Windels 618c4ffe20 restructure observable collections and fixes for sort, filter and map 2019-02-26 20:48:57 +01:00
Renamed from src/observable/map/operators/FilterOperator.js (Browse further)