hark: lazier notifications, update in add-graph

This commit is contained in:
Liam Fitzgerald 2020-12-17 11:59:35 +10:00
parent 7ae79cfb1a
commit 69c555c4b5
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
3 changed files with 21 additions and 19 deletions

View File

@ -159,7 +159,7 @@
[cards this]
==
++ add-graph
|= [rid=resource =graph:graph-store]
|= rid=resource
^- (quip card _state)
=/ group-rid=(unit resource)
(group-from-app-resource:met %graph rid)
@ -172,14 +172,20 @@
|(is-hidden &(watch-on-self =(our.bowl entity.rid)))
?. should-watch
`state
:- (give:ha ~[/updates] %listen [rid ~])
state(watching (~(put in watching) [rid ~]))
=/ graph=graph:graph-store :: graph in subscription is bunted
(get-graph-mop:gra rid)
=/ node=(unit node:graph-store)
(bind (peek:orm:graph-store graph) |=([@ =node:graph-store] node))
=^ cards state
(check-nodes (drop node) rid)
:_ state(watching (~(put in watching) [rid ~]))
(weld cards (give:ha ~[/updates] %listen [rid ~]))
::
++ graph-update
|= =update:graph-store
^- (quip card _state)
?: ?=(%add-graph -.q.update)
(add-graph resource.q.update graph.q.update)
(add-graph resource.q.update)
?. ?=(%add-nodes -.q.update)
[~ state]
=* rid resource.q.update

View File

@ -198,15 +198,8 @@
^- update:store
:- %more
^- (list update:store)
:+ give-unreads
[%set-dnd dnd]
%+ weld
%+ turn
(tap-nonempty:ha archive)
(timebox-update &)
%+ turn
(tap-nonempty:ha notifications)
(timebox-update |)
:- give-unreads
[%set-dnd dnd]~
::
++ give-since-unreads
^- (list [stats-index:store stats:store])
@ -234,12 +227,6 @@
^- update:store
:- %unreads
(weld give-each-unreads give-since-unreads)
::
++ timebox-update
|= archived=?
|= [time=@da =timebox:store]
^- update:store
[%timebox time archived ~(tap by timebox)]
--
::
++ on-peek

View File

@ -17,6 +17,15 @@
%+ scry-for update:store
/graph/(scot %p entity.res)/[name.res]
::
++ get-graph-mop
|= res=resource
^- graph:store
=/ =update:store
(get-graph res)
?> ?=(%0 -.res)
?> ?=(%add-graph -.q.update)
graph.q.update
::
++ gut-younger-node-siblings
|= [res=resource =index:store]
^- (map index:store node:store)