Commit 95d4771f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[tree] properly refresh tree after dispatch

parent e558ac4c
...@@ -6,7 +6,7 @@ import Data.Maybe (Maybe(..), fromMaybe) ...@@ -6,7 +6,7 @@ import Data.Maybe (Maybe(..), fromMaybe)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst, snd) import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log) import DOM.Simple.Console (log, log2)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -71,13 +71,14 @@ forestCpt = R.hooksComponentWithModule thisModule "forest" cpt where ...@@ -71,13 +71,14 @@ forestCpt = R.hooksComponentWithModule thisModule "forest" cpt where
/\ (fst asyncTasks).storage /\ (fst asyncTasks).storage
/\ handed /\ handed
) )
(cpt' openNodes asyncTasks reload showLogin backend) (cpt' openNodes asyncTasks appReload reload showLogin backend)
cpt' openNodes asyncTasks reload showLogin backend (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do cpt' openNodes asyncTasks appReload reload showLogin backend (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
pure $ R2.row $ [plus handed showLogin backend] <> trees pure $ R2.row $ [plus handed showLogin backend] <> trees
where where
trees = tree <$> unSessions sessions trees = tree <$> unSessions sessions
tree s@(Session {treeId}) = tree s@(Session {treeId}) =
treeView { asyncTasks treeView { appReload
, asyncTasks
, frontends , frontends
, handed , handed
, mCurrentRoute: Just route , mCurrentRoute: Just route
......
This diff is collapsed.
...@@ -5,6 +5,7 @@ import Data.Maybe (Maybe(..)) ...@@ -5,6 +5,7 @@ import Data.Maybe (Maybe(..))
import Data.Nullable (null) import Data.Nullable (null)
import Data.Tuple (snd) import Data.Tuple (snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (Aff, launchAff) import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import React.SyntheticEvent as E import React.SyntheticEvent as E
...@@ -39,7 +40,6 @@ import Gargantext.Utils.Reactix as R2 ...@@ -39,7 +40,6 @@ import Gargantext.Utils.Reactix as R2
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.Forest.Tree.Node" thisModule = "Gargantext.Components.Forest.Tree.Node"
-- Main Node -- Main Node
type NodeMainSpanProps = ( type NodeMainSpanProps = (
appReload :: GT.ReloadS appReload :: GT.ReloadS
...@@ -51,6 +51,7 @@ type NodeMainSpanProps = ( ...@@ -51,6 +51,7 @@ type NodeMainSpanProps = (
, mCurrentRoute :: Maybe Routes.AppRoute , mCurrentRoute :: Maybe Routes.AppRoute
, name :: Name , name :: Name
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
| CommonProps | CommonProps
) )
...@@ -83,6 +84,7 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt ...@@ -83,6 +84,7 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
, name , name
, nodeType , nodeType
, session , session
, setPopoverRef
} _ = do } _ = do
-- only 1 popup at a time is allowed to be opened -- only 1 popup at a time is allowed to be opened
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile) droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
...@@ -90,6 +92,9 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt ...@@ -90,6 +92,9 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
popoverRef <- R.useRef null popoverRef <- R.useRef null
R.useEffect' $ do
R.setRef setPopoverRef $ Just $ Popover.setOpen popoverRef
let ordering = let ordering =
case handed of case handed of
GT.LeftHanded -> reverse GT.LeftHanded -> reverse
......
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