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
133
Issues
133
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
269b6726
Commit
269b6726
authored
Jan 26, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-tree-somehow' into dev-merge
parents
7b0443df
06a87aa3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+21
-14
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
269b6726
...
...
@@ -41,36 +41,43 @@ treeViewCpt = R.hooksComponent "G.C.Tree.treeView" cpt
-- NOTE: this is a hack to reload the tree view on demand
reload <- R.useState' (0 :: Reload)
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: Set TreeId)
pure $ treeLoadView
reload
{ root, mCurrentRoute, session, frontends, openNodes }
pure $ treeLoadView
{ root, mCurrentRoute, session, frontends, openNodes
, reload
}
type Props' = ( root :: ID
, mCurrentRoute :: Maybe AppRoute
, session :: Session
, frontends :: Frontends
, openNodes :: R.State (Set TreeId)
, reload :: R.State Reload
)
treeLoadView :: R.State Reload -> Record Props' -> R.Element
treeLoadView reload p = R.createElement el p []
treeLoadView :: Record Props' -> R.Element
treeLoadView p = R.createElement treeLoadView' p []
treeLoadView' :: R.Component Props'
treeLoadView' = R.staticComponent "TreeLoadView" cpt
where
el = R.staticComponent "TreeLoadView" cpt
cpt {root, mCurrentRoute, session, frontends, openNodes} _ = do
cpt {root, mCurrentRoute, session, frontends, openNodes, reload} _ = do
loader root (loadNode session) $ \loaded ->
loadedTreeView
reload {tree: loaded, mCurrentRoute, session, frontends, openNodes
}
loadedTreeView
{tree: loaded, mCurrentRoute, session, frontends, openNodes, reload
}
type TreeViewProps = ( tree :: FTree
, mCurrentRoute :: Maybe AppRoute
, frontends :: Frontends
, session :: Session
, openNodes :: R.State (Set TreeId)
, reload :: R.State Reload
)
loadedTreeView :: R.State Reload -> Record TreeViewProps -> R.Element
loadedTreeView reload p = R.createElement el p []
loadedTreeView :: Record TreeViewProps -> R.Element
loadedTreeView p = R.createElement loadedTreeView' p []
loadedTreeView' :: R.Component TreeViewProps
loadedTreeView' = R.hooksComponent "LoadedTreeView" cpt
where
el = R.hooksComponent "LoadedTreeView" cpt
cpt {tree, mCurrentRoute, session, frontends, openNodes} _ = do
cpt {tree, mCurrentRoute, session, frontends, openNodes, reload} _ = do
treeState <- R.useState' {tree, asyncTasks: []}
pure $ H.div {className: "tree"}
...
...
@@ -110,9 +117,9 @@ toHtml reload treeState@(ts@{tree: (NTree (LNode {id, name, nodeType}) ary), asy
)
]
onAsyncTaskFinish (AsyncTask {id}) = setTreeState $ const $ ts { asyncTasks = newAsyncTasks }
onAsyncTaskFinish (AsyncTask {id
: id_
}) = setTreeState $ const $ ts { asyncTasks = newAsyncTasks }
where
newAsyncTasks = A.filter (\(AsyncTask {id: id'}) -> id /= id') asyncTasks
newAsyncTasks = A.filter (\(AsyncTask {id: id'}) -> id
_
/= id') asyncTasks
childNodes :: Session
...
...
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