Commit graph

35 commits

Author SHA1 Message Date
Bruno Windels
a0f443ccc3
Merge pull request #521 from DanilaFe/typescript-observable
Start migrating Observable code to TypeScript.
2021-10-01 09:54:29 +02:00
Bruno Windels
e42739ec81 scroll room list to top when entering query first 2021-09-30 17:19:42 +02:00
Danila Fedorin
d73dea797a Rename BaseObservable to TypeScript 2021-09-29 17:18:22 -07:00
Bruno Windels
e105bc4237 fix lint warnings 2021-08-24 15:31:18 +02:00
RMidhunSuresh
dea0cad252 Fix bug in FilteredMap
Caused multiple updates to be triggered.

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
RMidhunSuresh
f41c835e91 Support updater in MappedMap
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
RMidhunSuresh
2e8c4563aa Implement set method to support update from value
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
Bruno Windels
2152d5e833 expose reactions on base message tile as vm with observable list 2021-06-03 19:15:49 +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
025320b83e fix filtered map 2021-04-27 16:15:20 +02:00
Bruno Windels
ff4abbc5ba make dispose not fail 2021-04-22 17:18:07 +02:00
Bruno Windels
4e3127c4cf handle key collisions in JoinedMap 2021-04-22 13:28:14 +02:00
Bruno Windels
f596b34cac add very basic join observable map, joining several maps into one
will be used to join invites and rooms into one map
2021-04-21 17:25:37 +02:00
Bruno Windels
1d3a2aca0e add 'get' method to common observable map api 2021-04-21 17:23:49 +02:00
Bruno Windels
b27f6a067f implement .size for all observable maps
as SortedMapList uses it, putting undefined in its list
initially when missing, creating a crash in
the TemplateView that renders it
2020-11-05 12:00:17 +01:00
Bruno Windels
4e8e9eae26 first round of fixes 2020-10-12 18:31:55 +02:00
Bruno Windels
e3fdd3a4fd ApplyMap, your observable map collection for applying side-effects 2020-10-06 12:20:28 +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
84425fad5c more work on FilteredMap (not done yet though)
I ended up not using this, but at some point we'll need it,
so commit this work
2020-10-06 12:19:08 +02:00
Bruno Windels
943467cf67 actually implemented filtered map 2020-10-05 18:18:44 +02:00
Bruno Windels
8b358379e8 first draft of device tracker
mainly missing race protection with /sync and actually running the code
2020-08-31 14:12:12 +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
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
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
21d93a5893 fix and test initialValues for map 2019-02-26 21:13:11 +01:00
Bruno Windels
618c4ffe20 restructure observable collections and fixes for sort, filter and map 2019-02-26 20:48:57 +01:00
Bruno Windels
d5b88cbbe6 finish ObservableMap and add tests 2019-02-24 19:24:28 +01:00
Bruno Windels
1441abbf7e work on sorted list from map 2019-02-21 23:08:23 +01:00
Bruno Windels
5bff41c1ee wip on collections and listview 2019-02-20 23:48:16 +01:00