Commit 683f495e authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'feature/toestand-global-state' of...

Merge branch 'feature/toestand-global-state' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents dcc61ff7 ebb67a01
......@@ -13,10 +13,10 @@ import Gargantext.Utils.Toestand as T2
type App =
{ backend :: Maybe Backend
, handed :: Handed
, forestOpen :: OpenNodes
, reloadRoot :: Int
, handed :: Handed
, reloadForest :: Int
, reloadRoot :: Int
, route :: AppRoute
, sessions :: Sessions
, showCorpus :: Boolean
......@@ -26,11 +26,11 @@ type App =
emptyApp :: App
emptyApp =
{ backend: Nothing
, handed: RightHanded
, route: Home
, forestOpen: Set.empty
, reloadRoot: T2.newReload
, handed: RightHanded
, reloadForest: T2.newReload
, reloadRoot: T2.newReload
, route: Home
, sessions: Sessions.empty
, showCorpus: false
, showLogin: false
......@@ -38,10 +38,10 @@ emptyApp =
type Boxes =
{ backend :: T.Box (Maybe Backend)
, handed :: T.Box Handed
, forestOpen :: T.Box OpenNodes
, reloadRoot :: T.Box T2.Reload
, handed :: T.Box Handed
, reloadForest :: T.Box T2.Reload
, reloadRoot :: T.Box T2.Reload
, route :: T.Box AppRoute
, sessions :: T.Box Sessions
, showCorpus :: T.Box Boolean
......
......@@ -73,10 +73,12 @@ treeLoader = R.createElement treeLoaderCpt
treeLoaderCpt :: R.Component LoaderProps
treeLoaderCpt = here.component "treeLoader" cpt where
-- treeLoaderCpt :: R.Memo LoaderProps
-- treeLoaderCpt = R.memo (here.component "treeLoader" cpt) memoCmp where
-- memoCmp ({ root: t1 }) ({ root: t2 }) = t1 == t2
cpt p@{ root, session } _ = do
app <- T.useLive T.unequal p.reloadRoot
reload <- T.useLive T.unequal p.reload
let fetch _ = getNodeTree session root
let fetch { root: r } = getNodeTree session r
useLoader { app, root } fetch loaded where
loaded tree' = tree props where
props = Record.merge common extra where
......
......@@ -58,8 +58,10 @@ routerCpt = here.component "router" cpt where
let session = R.createContext (unsafeCoerce {})
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
showLogin <- T.useLive T.unequal boxes.showLogin
route' <- T.useLive T.unequal boxes.route
pure $ R.fragment
[ if showLogin then login' boxes else H.div {} []
, case route' of
......
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