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] [cards this]
== ==
++ add-graph ++ add-graph
|= [rid=resource =graph:graph-store] |= rid=resource
^- (quip card _state) ^- (quip card _state)
=/ group-rid=(unit resource) =/ group-rid=(unit resource)
(group-from-app-resource:met %graph rid) (group-from-app-resource:met %graph rid)
@ -172,14 +172,20 @@
|(is-hidden &(watch-on-self =(our.bowl entity.rid))) |(is-hidden &(watch-on-self =(our.bowl entity.rid)))
?. should-watch ?. should-watch
`state `state
:- (give:ha ~[/updates] %listen [rid ~]) =/ graph=graph:graph-store :: graph in subscription is bunted
state(watching (~(put in watching) [rid ~])) (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 ++ graph-update
|= =update:graph-store |= =update:graph-store
^- (quip card _state) ^- (quip card _state)
?: ?=(%add-graph -.q.update) ?: ?=(%add-graph -.q.update)
(add-graph resource.q.update graph.q.update) (add-graph resource.q.update)
?. ?=(%add-nodes -.q.update) ?. ?=(%add-nodes -.q.update)
[~ state] [~ state]
=* rid resource.q.update =* rid resource.q.update

View File

@ -198,15 +198,8 @@
^- update:store ^- update:store
:- %more :- %more
^- (list update:store) ^- (list update:store)
:+ give-unreads :- give-unreads
[%set-dnd dnd] [%set-dnd dnd]~
%+ weld
%+ turn
(tap-nonempty:ha archive)
(timebox-update &)
%+ turn
(tap-nonempty:ha notifications)
(timebox-update |)
:: ::
++ give-since-unreads ++ give-since-unreads
^- (list [stats-index:store stats:store]) ^- (list [stats-index:store stats:store])
@ -234,12 +227,6 @@
^- update:store ^- update:store
:- %unreads :- %unreads
(weld give-each-unreads give-since-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 ++ on-peek

View File

@ -17,6 +17,15 @@
%+ scry-for update:store %+ scry-for update:store
/graph/(scot %p entity.res)/[name.res] /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 ++ gut-younger-node-siblings
|= [res=resource =index:store] |= [res=resource =index:store]
^- (map index:store node:store) ^- (map index:store node:store)