Commit 200210b7 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/704-dev-fix-ws-update-for-a-pinned-tree' into dev

parents e6b0b8e2 1d6b5e94
Pipeline #6821 canceled with stages
......@@ -126,12 +126,13 @@ treeLoaderCpt = R2.hereComponent here "treeLoader" hCpt where
-- app <- T.useLive T.unequal p.reloadRoot
state /\ stateBox <- R2.useBox' Nothing
let fetch { root: r } = getNodeTree session r
reload' <- T.useLive T.unequal p.reload
-- Hooks
useLoaderEffect
{ errorHandler
, loader: fetch
, path: { root }
, path: { root, reload: reload' }
, state: stateBox
}
......@@ -174,6 +175,20 @@ treeCpt = here.component "tree" cpt where
folderOpen <- useOpenNodesMemberBox nodeId forestOpen
folderOpen' <- T.useLive T.unequal folderOpen
R.useEffectOnce' $ do
-- We set up notifications listener here. 'tree' is only a
-- component for the root of the tree, other subtrees are
-- rendered via 'childLoader'. However, we still need a hook
-- here, so that if e.g. the tree is pinned, it becomes its own
-- root and we want to see notifications of it as well.
let cb _ = do
here.log2 "[tree] callback!" root
-- The modal window has some problems closing when we refresh too early. This is a HACK
void $ setTimeout 400 $ T2.reload reload
let action = NotificationsT.InsertCallback (NotificationsT.UpdateTree root) ("tree-" <> show root) cb
ws <- T.read boxes.wsNotification
Notifications.performAction ws action
R.useEffect' do
selectedLeaf <- R2.querySelector ".mainleaf--selected"
case selectedLeaf of
......@@ -323,11 +338,10 @@ childLoaderCpt = R2.hereComponent here "childLoader" hCpt where
boxes <- Store.use
R.useEffectOnce' $ do
let cb _ = do
here.log2 "callback!" p.id
here.log2 "[childLoader] callback!" p.id
-- The modal window has some problems closing when we refresh too early. This is a HACK
void $ setTimeout 400 $ T2.reload reload
let action = NotificationsT.InsertCallback (NotificationsT.UpdateTree p.id) ("tree-" <> show p.id) cb
here.log2 "[childLoader] action" action
ws <- T.read boxes.wsNotification
Notifications.performAction ws action
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment