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
caa6d693
Unverified
Commit
caa6d693
authored
Dec 03, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak debuging code
parent
e2f88a6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
Loader.purs
src/Gargantext/Components/Loader.purs
+11
-3
Table.purs
src/Gargantext/Components/Table.purs
+1
-0
Documents.purs
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
+2
-2
No files found.
src/Gargantext/Components/Loader.purs
View file @
caa6d693
...
...
@@ -37,6 +37,7 @@ type State path loaded = { currentPath :: path, loaded :: Maybe loaded }
createLoaderClass' :: forall path loaded props
. Eq path
=> Show path
=> String
-> (path -> Aff loaded)
-> Render (State path loaded) {path :: path | props} (Action path)
...
...
@@ -44,12 +45,16 @@ createLoaderClass' :: forall path loaded props
createLoaderClass' name loader render =
React.component name
(\this -> do
logs $ "createLoaderClass' " <> name
s <- spec this
pure { state: s.state
, render: s.render
, componentDidMount: dispatcher this ForceReload
, componentDidUpdate: \_prevProps {currentPath} _snapshot -> do
, componentDidMount: do
logs $ name <> ".componentDidMount"
dispatcher this ForceReload
, componentDidUpdate: \{path: prevPath} {currentPath} _snapshot -> do
{path} <- React.getProps this
logs $ name <> ".componentDidUpdate " <> show {currentPath, path, prevPath}
-- This guard is the same as in performAction (SetPath ...),
-- however we need it here to avoid potential infinite loops.
-- https://reactjs.org/docs/react-component.html#componentdidupdate
...
...
@@ -61,9 +66,11 @@ createLoaderClass' name loader render =
performAction :: PerformAction (State path loaded) {path :: path | props} (Action path)
performAction ForceReload _ {currentPath} = do
logs $ name <> ".ForceReload {currentPath: " <> show currentPath <> "}"
loaded <- lift $ loader currentPath
modifyState_ $ _ { loaded = Just loaded }
performAction (SetPath newPath) _ {currentPath} =
performAction (SetPath newPath) _ {currentPath} = do
logs $ name <> ".SetPath " <> show {newPath, currentPath}
when (newPath /= currentPath) do
loaded <- lift $ loader newPath
modifyState_ $ _ { currentPath = newPath, loaded = Just loaded }
...
...
@@ -75,6 +82,7 @@ type LoaderClass path loaded =
createLoaderClass :: forall path loaded
. Eq path
=> Show path
=> String
-> (path -> Aff loaded)
-> LoaderClass path loaded
...
...
src/Gargantext/Components/Table.purs
View file @
caa6d693
...
...
@@ -131,6 +131,7 @@ tableSpec = simpleSpec performAction render
where
modifyStateAndReload :: (State -> State) -> Props -> State -> StateCoTransformer State Unit
modifyStateAndReload f {setParams} state = do
logs "modifyStateAndReload" -- TODO rename
modifyState_ f
liftEffect $ setParams $ stateParams $ f state
...
...
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
View file @
caa6d693
...
...
@@ -197,8 +197,8 @@ loadPage {nodeId, params: {limit, offset, orderBy}} = do
--res <- get $ toUrl Back (Children Url_Document offset limit) nodeId
res <- get $ toUrl Back (Tab TabDocs offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let docs = res2corpus <$> res
_ <- logs "Ok: loading page documents"
_ <- logs $ map show docs
--
_ <- logs "Ok: loading page documents"
--
_ <- logs $ map show docs
pure $
if mock then take limit $ drop offset sampleData else
docs
...
...
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