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
1
Merge Requests
1
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
Przemyslaw Kaminski
purescript-gargantext
Commits
3b6e5e7b
Commit
3b6e5e7b
authored
Nov 13, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] more careful usage of cleanup code
Now state change doesn't refresh the graph.
parent
9ad149cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
Graph.purs
src/Gargantext/Components/Graph.purs
+6
-1
Sigmax.purs
src/Gargantext/Hooks/Sigmax.purs
+24
-13
No files found.
src/Gargantext/Components/Graph.purs
View file @
3b6e5e7b
...
@@ -9,6 +9,7 @@ import Data.Maybe (Maybe)
...
@@ -9,6 +9,7 @@ import Data.Maybe (Maybe)
import Data.Nullable (null)
import Data.Nullable (null)
import Data.Sequence as Seq
import Data.Sequence as Seq
import DOM.Simple.Console (log, log2)
import DOM.Simple.Console (log, log2)
import FFI.Simple (delay)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as RH
import Reactix.DOM.HTML as RH
...
@@ -47,10 +48,14 @@ graphCpt = R.hooksComponent "Graph" cpt
...
@@ -47,10 +48,14 @@ graphCpt = R.hooksComponent "Graph" cpt
ref <- R.useRef null
ref <- R.useRef null
--startSigma ref props.sigmaRef props.sigmaSettings props.forceAtlas2Settings props.graph
--startSigma ref props.sigmaRef props.sigmaSettings props.forceAtlas2Settings props.graph
R.useEffectOnce
'
$ do
R.useEffectOnce $ do
log "[graphCpt] calling startSigmaEff"
log "[graphCpt] calling startSigmaEff"
startSigmaEff ref props.sigmaRef props.sigmaSettings props.forceAtlas2Settings props.graph
startSigmaEff ref props.sigmaRef props.sigmaSettings props.forceAtlas2Settings props.graph
delay unit $ \_ -> do
log "[GraphCpt] cleaning up"
pure $ pure unit
pure $ RH.div { ref, style: {height: "95%"} } []
pure $ RH.div { ref, style: {height: "95%"} } []
type SigmaSettings =
type SigmaSettings =
...
...
src/Gargantext/Hooks/Sigmax.purs
View file @
3b6e5e7b
...
@@ -220,15 +220,25 @@ dependOnContainer container notFoundMsg f = do
...
@@ -220,15 +220,25 @@ dependOnContainer container notFoundMsg f = do
startSigmaEff :: forall settings faSettings n e. R.Ref (Nullable Element) -> R.Ref Sigma -> settings -> faSettings -> Graph n e -> Effect Unit
startSigmaEff :: forall settings faSettings n e. R.Ref (Nullable Element) -> R.Ref Sigma -> settings -> faSettings -> Graph n e -> Effect Unit
startSigmaEff ref sigmaRef settings forceAtlas2Settings graph = do
startSigmaEff ref sigmaRef settings forceAtlas2Settings graph = do
log "[startSigmaEff] calling useSigmaEff"
let rSigma = R.readRef sigmaRef
sigma <- useSigmaEff settings sigmaRef
case readSigma rSigma of
log "[startSigmaEff] calling useCanvasRendererEff"
Nothing -> do
useCanvasRendererEff ref sigma
log "[startSigmaEff] calling useSigmaEff"
sigma <- useSigmaEff settings sigmaRef
log "[startSigmaEff] calling useDataEff"
log "[startSigmaEff] calling useCanvasRendererEff"
useDataEff sigma graph
useCanvasRendererEff ref sigma
log "[startSigmaEff] calling useForceAtlas2Eff"
useForceAtlas2Eff sigma forceAtlas2Settings
log "[startSigmaEff] calling useDataEff"
useDataEff sigma graph
log "[startSigmaEff] calling useForceAtlas2Eff"
useForceAtlas2Eff sigma forceAtlas2Settings
Just sig -> do
log "[startSigmaEff] sigma initialized already"
useCanvasRendererEff ref rSigma
useDataEff rSigma graph
--useForceAtlas2Eff rSigma forceAtlas2Settings
Sigma.refreshForceAtlas sig
pure unit
--handleRefresh sigma
--handleRefresh sigma
...
@@ -275,9 +285,10 @@ useCanvasRendererEff container sigma =
...
@@ -275,9 +285,10 @@ useCanvasRendererEff container sigma =
withSigma sig = addRenderer sig renderer >>= handle
withSigma sig = addRenderer sig renderer >>= handle
where -- close over sig
where -- close over sig
renderer = { "type": "canvas", container: c }
renderer = { "type": "canvas", container: c }
handle (Right _) = cleanupFirst sigma (Sigma.killRenderer sig renderer >>= logCleanup)
handle _ = log "[useCanvasRenderer] cleanup handle"
handle (Left e) =
--handle (Right _) = cleanupFirst sigma (Sigma.killRenderer sig renderer >>= logCleanup)
log2 errorAddingMsg e *> cleanupSigma sigma "useCanvasRenderer"
--handle (Left e) =
-- log2 errorAddingMsg e *> cleanupSigma sigma "useCanvasRenderer"
logCleanup (Left e) = log2 errorKillingMsg e
logCleanup (Left e) = log2 errorKillingMsg e
logCleanup _ = log killedMsg
logCleanup _ = log killedMsg
containerNotFoundMsg = "[useCanvasRenderer] Container not found, not adding renderer"
containerNotFoundMsg = "[useCanvasRenderer] Container not found, not adding renderer"
...
@@ -294,6 +305,6 @@ useForceAtlas2Eff sigma settings = effect
...
@@ -294,6 +305,6 @@ useForceAtlas2Eff sigma settings = effect
log startingMsg
log startingMsg
log sigma
log sigma
Sigma.startForceAtlas2 sig settings
Sigma.startForceAtlas2 sig settings
cleanupFirst sigma (Sigma.killForceAtlas2 sig)
--
cleanupFirst sigma (Sigma.killForceAtlas2 sig)
startingMsg = "[Graph] Starting ForceAtlas2"
startingMsg = "[Graph] Starting ForceAtlas2"
sigmaNotFoundMsg = "[Graph] Sigma not found, not initialising"
sigmaNotFoundMsg = "[Graph] Sigma not found, not initialising"
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