Commit a0efc70b authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graphexplorer] add explorerLayoutWithKey to force graph refresh

There was an issue when changing graphs that sigma didn't refresh
properly. The "key" prop should solve this issue.
parent b2d308ef
......@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer where
import Gargantext.Prelude hiding (max, min)
import Control.Bind ((=<<))
import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Either (Either)
......@@ -22,6 +23,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Data.Louvain as Louvain
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Sigmax.Sigma (startForceAtlas2)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get)
......@@ -60,7 +62,19 @@ type GraphWriteProps =
| Props
)
type LayoutWithKeyProps =
( key :: String
| LayoutProps )
--------------------------------------------------------------
explorerLayoutWithKey :: R2.Component LayoutWithKeyProps
explorerLayoutWithKey = R.createElement explorerLayoutWithKeyCpt
explorerLayoutWithKeyCpt :: R.Component LayoutWithKeyProps
explorerLayoutWithKeyCpt = here.component "explorerLayoutWithKey" cpt where
cpt { boxes, graphId, session } _ = do
pure $ explorerLayout { boxes, graphId, session } []
explorerLayout :: R2.Component LayoutProps
explorerLayout = R.createElement explorerLayoutCpt
explorerLayoutCpt :: R.Component LayoutProps
......
......@@ -427,9 +427,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
, nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session ->
GraphExplorer.explorerLayout { boxes
, graphId: nodeId
, session } [] } sessionProps) []
GraphExplorer.explorerLayoutWithKey { boxes
, graphId: nodeId
, key: "graphId-" <> show nodeId
, session } [] } sessionProps) []
-- GraphExplorer.explorerLayout { boxes
-- , graphId: nodeId
-- , session } [] } sessionProps) []
phyloExplorer :: R2.Component SessionNodeProps
phyloExplorer = R.createElement phyloExplorerCpt
phyloExplorerCpt :: R.Component SessionNodeProps
......
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