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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
c6497f31
Commit
c6497f31
authored
Sep 10, 2021
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[subtree] Fold subtree node by default
* #308 (2): resolve re-render issue
parent
e4531010
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
19 deletions
+47
-19
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+46
-18
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+1
-1
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
c6497f31
module Gargantext.Components.Forest.Tree.Node.Action.Move where
module Gargantext.Components.Forest.Tree.Node.Action.Move
( moveNodeReq
, moveNode
) where
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (
subTreeView, SubTreeParamsIn
)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (
SubTreeParamsIn, subTreeView
)
import Gargantext.Config.REST (RESTError)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
...
...
@@ -30,22 +33,47 @@ moveNodeCpt = here.component "moveNode" cpt
where
cpt { boxes, dispatch, id, nodeType, session, subTreeParams } _ = do
action :: T.Box Action <- T.useBox (MoveNode {params: Nothing})
action' <- T.useLive T.unequal action
let button = case action' of
MoveNode { params } -> case params of
Just val -> submitButton (MoveNode {params: Just val}) dispatch
Nothing -> H.div {} []
_ -> H.div {} []
pure $
panel [ subTreeView { action
, boxes
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
] button
moveNode' { action
, boxes
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
type Props =
( action :: T.Box Action
| SubTreeParamsIn
)
-- @XXX re-render issue -> clone component
moveNode' :: R2.Component Props
moveNode' = R.createElement moveNodeCpt'
moveNodeCpt' :: R.Component Props
moveNodeCpt' = here.component "foo" cpt where
cpt { boxes, dispatch, id, nodeType, session, subTreeParams, action } _ = do
action' <- T.useLive T.unequal action
let button = case action' of
MoveNode { params } -> case params of
Just val -> submitButton (MoveNode {params: Just val}) dispatch
Nothing -> H.div {} []
_ -> H.div {} []
pure $
panel
[ subTreeView { action
, boxes
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
] button
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
c6497f31
...
...
@@ -44,7 +44,7 @@ type SubTreeParamsProps =
)
subTreeView :: R2.Component SubTreeParamsProps
subTreeView = R.createElement subTreeViewCpt
subTreeView = R.createElement
$ R.memo'
subTreeViewCpt
subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = here.component "subTreeView" cpt
where
...
...
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