Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
1d6b5e94
Verified
Commit
1d6b5e94
authored
Oct 09, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ws] fix refreshing of a pinned tree
parent
cb9a6dd5
Pipeline
#6803
passed with stages
in 13 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+17
-3
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+2
-2
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
1d6b5e94
...
...
@@ -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
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
1d6b5e94
...
...
@@ -327,8 +327,8 @@ nodeSpanCpt = here.component "nodeSpan" cpt
{ name: "thumb-tack-inclined"
, className: "mainleaf__pin-icon"
, callback: \_ -> do
log2 "[Pinning tree ID]" id
T.modify_ (Map.insert (show session) id) boxes.pinnedTreeId
log2 "[Pinning tree ID]" id
T.modify_ (Map.insert (show session) id) boxes.pinnedTreeId
, title: "Pin the tree to this node"
, variant: Secondary
, elevation: Level1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment