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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
42e86b3a
Commit
42e86b3a
authored
Jul 26, 2021
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> BEGIN
parent
cfd99a6b
Pipeline
#1675
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
Router.purs
src/Gargantext/Components/Router.purs
+12
-2
No files found.
src/Gargantext/Components/Router.purs
View file @
42e86b3a
...
@@ -60,6 +60,10 @@ routerCpt = here.component "router" cpt where
...
@@ -60,6 +60,10 @@ routerCpt = here.component "router" cpt where
cpt { boxes: boxes@{ handed } } _ = do
cpt { boxes: boxes@{ handed } } _ = do
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
-- adding a state live for a Prop *not used* by the MainPage component
-- (this box store the flag for displaying or not the sidebar)
showTree <- T.useLive T.unequal boxes.showTree
let handedClassName = case handed' of
let handedClassName = case handed' of
LeftHanded -> "left-handed"
LeftHanded -> "left-handed"
RightHanded -> "right-handed"
RightHanded -> "right-handed"
...
@@ -102,8 +106,14 @@ topBarCpt = here.component "topBar" cpt where
...
@@ -102,8 +106,14 @@ topBarCpt = here.component "topBar" cpt where
mainPage :: R2.Leaf Props
mainPage :: R2.Leaf Props
mainPage p = R.createElement mainPageCpt p []
mainPage p = R.createElement mainPageCpt p []
mainPageCpt :: R.Component Props
-- So every times the user show/hide the sidebar, the mainPage will re-render
mainPageCpt = here.component "mainPage" cpt where
-- on some pages
-- It can be problematic, like with the page displaying a Docs and
-- its associated chart, as they will re-render each time ShowTree changes
--
-- By adding a React.memo here, it won't re-render on ShowTree changes
mainPageCpt :: R.Memo Props
mainPageCpt = R.memo' $ here.component "mainPage" cpt where
cpt { boxes } _ = do
cpt { boxes } _ = do
pure $ MainPage.mainPage { boxes } [ renderRoute { boxes } ]
pure $ MainPage.mainPage { boxes } [ renderRoute { boxes } ]
...
...
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