Commit c41a5b02 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/465-dev-graph-explorer-recursion-error' into dev-merge

parents 2e4c9344 2ddee534
Pipeline #3424 failed with stage
in 0 seconds
let upstream =
https://github.com/garganscript/package-sets/releases/download/v0.1.4/release.dhall
sha256:e03eafe0c7ea0ac143d07ec6d9f20c804bd6b6f95a8d89bf287c279e770584c8
https://github.com/garganscript/package-sets/releases/download/v0.1.6/release.dhall sha256:443a37602d5b9353c4daf4349079a77d5dddf07a7b35219016b167404d1e1138
let overrides =
{ graphql-client =
......@@ -61,8 +60,7 @@ let overrides =
, version = "v9.2.2"
}
, jest =
{ -- markdown-it dependency
dependencies =
{ dependencies =
[ "aff"
, "aff-promise"
, "effect"
......@@ -125,7 +123,7 @@ let additions =
, "unsafe-coerce"
]
, repo = "https://github.com/garganscript/purescript-sequences.git"
, version = "7ad61fde5239fbf66ceeefc0b7608aa9cbc53701"
, version = "recursion-fix"
}
, spec-discovery =
{ dependencies = [ "prelude", "effect", "arrays", "spec", "node-fs" ]
......@@ -194,4 +192,4 @@ let additions =
}
}
in upstream // overrides // additions
in upstream ⫽ overrides ⫽ additions
......@@ -70,7 +70,6 @@ to generate this file without the comments in this block.
, "record"
, "record-extra"
, "routing"
, "sequences"
, "simple-json"
, "simple-json-generics"
, "simplecrypto"
......
......@@ -33,6 +33,9 @@ options =
, sustainingPhaseDuration : Nothing
}
cname :: String
cname = "b-cloak"
-- | Abstract component type easing the transition display between a content
-- | component and transitional (or cloak) component
-- |
......@@ -108,10 +111,6 @@ options =
-- | ```
cloak :: forall r. R2.OptLeaf Options Props r
cloak = R2.optLeaf component options
cname :: String
cname = "b-cloak"
component :: R.Component Props
component = R.hooksComponent cname cpt where
cpt props _ = do
......
......@@ -49,7 +49,6 @@ type GraphUpdateButtonProps =
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
where
......
......@@ -51,8 +51,8 @@ type Props =
layout :: R2.Leaf Props
layout = R2.leaf layoutCpt
layoutCpt :: R.Memo Props
layoutCpt = R.memo' $ here.component "explorerWriteGraph" cpt where
layoutCpt :: R.Component Props
layoutCpt = here.component "layout" cpt where
cpt { fa2Ref
, sigmaRef
} _ = do
......
......@@ -64,7 +64,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
, edgeConfluence
, edgeWeight
, forceAtlasState
, graph
, graphStage
, hyperdataGraph
, mouseSelectorSize
......@@ -78,7 +77,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
edgeWeight' <- R2.useLive' edgeWeight
forceAtlasState' <- R2.useLive' forceAtlasState
graphStage' <- R2.useLive' graphStage
graph' <- R2.useLive' graph
startForceAtlas' <- R2.useLive' startForceAtlas
hyperdataGraph' <- R2.useLive' hyperdataGraph
......@@ -101,7 +99,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
here.log "[drawGraph (Cleanup)] sigma killed"
-- Stage Init
R.useEffect1' graphStage' $ case graphStage' of
R.useEffect2' hyperdataGraph' graphStage' $ case graphStage' of
GET.Init -> do
let mCamera = getter _.mCamera hyperdataGraph'
......
......@@ -160,7 +160,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt where
sideTabData :: R2.Leaf Props
sideTabData = R2.leaf sideTabDataCpt
sideTabDataCpt :: R.Component Props
sideTabDataCpt = here.component "sideTabData" cpt where
cpt props _ = do
......
......@@ -31,7 +31,6 @@ type Props =
legend :: R2.Leaf Props
legend = R2.leaf legendCpt
legendCpt :: R.Component Props
legendCpt = here.component "legend" cpt where
cpt { legendSeq
......
......@@ -54,9 +54,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, edgeWeight
, forceAtlasState
, graph
, graphId
, graphStage
, hyperdataGraph
, labelRenderedSizeThreshold
, labelSize
, mouseSelectorSize
......@@ -71,9 +69,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
forceAtlasState' <- R2.useLive' forceAtlasState
graph' <- R2.useLive' graph
graphId' <- R2.useLive' graphId
graphStage' <- R2.useLive' graphStage
hyperdataGraph' <- R2.useLive' hyperdataGraph
selectedNodeIds' <- R2.useLive' selectedNodeIds
showSidebar' <- R2.useLive' showSidebar
......@@ -89,7 +85,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- When graph is changed, cleanup the mFAPauseRef so that forceAtlas
-- timeout is retriggered.
R.useEffect' $ do
R.useEffect1' graphStage' $ do
case graphStage' of
GET.Init -> R.setRef mFAPauseRef Nothing
_ -> pure unit
......
module Gargantext.Components.Nodes.Corpus.Graph
module Gargantext.Components.Nodes.Graph
( node
) where
......@@ -6,7 +6,7 @@ import Gargantext.Prelude
import DOM.Simple (document, querySelector)
import Data.Int as I
import Data.Maybe (Maybe(..), isJust, maybe)
import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Sequence as Seq
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
......@@ -27,14 +27,16 @@ import Gargantext.Utils (getter)
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
type Props =
( graphId :: GET.GraphId
)
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Graph"
here = R2.here "Gargantext.Components.Nodes.Graph"
node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt
......@@ -49,8 +51,8 @@ nodeCpt = here.component "node" cpt where
session <- useSession
graphVersion' <- R2.useLive' graphVersion
state' /\ state <- R2.useBox' Nothing
cache' /\ cache <- R2.useBox' (GET.defaultCacheParams :: GET.CacheParams)
state <- T.useBox Nothing
cache <- T.useBox (GET.defaultCacheParams :: GET.CacheParams)
-- | Computed
-- |
......@@ -82,8 +84,23 @@ nodeCpt = here.component "node" cpt where
-- | Render
-- |
pure $
pure $ renderNode { cache, graphId, state }
type RenderNodeProps = (
cache :: T.Box GET.CacheParams,
graphId :: GET.GraphId,
state :: T.Box (Maybe GET.HyperdataGraph)
)
renderNode :: R2.Leaf RenderNodeProps
renderNode = R2.leaf renderNodeCpt
renderNodeCpt :: R.Component RenderNodeProps
renderNodeCpt = here.component "renderNode" cpt where
cpt { cache, graphId, state } _ = do
cache' <- T.useLive T.unequal cache
state' <- T.useLive T.unequal state
pure $
B.cloak
{ isDisplayed: isJust state'
, idlingPhaseDuration: Just 150
......@@ -167,6 +184,7 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
-- |
pure $
GraphStore.provide
state
[
......
......@@ -23,8 +23,8 @@ import Gargantext.Components.Nodes.Corpus as Corpus
import Gargantext.Components.Nodes.Corpus.Code (corpusCodeLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Document as Document
import Gargantext.Components.Nodes.Corpus.Graph as Graph
import Gargantext.Components.Nodes.Corpus.Phylo as Phylo
import Gargantext.Components.Nodes.Graph as Graph
import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.Frame as Frame
import Gargantext.Components.Nodes.Home (homeLayout)
......
......@@ -78,7 +78,7 @@ useLoaderEffect { errorHandler, loader: loader', path, state } = do
state' <- T.useLive T.unequal state
oPath <- R.useRef path
R.useEffect' $ do
R.useEffect2' path state' $ do
path' <- R.readRefM oPath
if (path' == path) && (isJust state')
then pure $ R.nothing
......
......@@ -44,12 +44,9 @@ newGraph = runEffectFn1 _newGraph
graphFromSigmaxGraph :: Types.Graph Types.Node Types.Edge -> Effect Graph
graphFromSigmaxGraph (Types.Graph g) = do
graph <- newGraph unit
_ <- traverse (addNode graph) nodes
_ <- traverse (addEdge graph) edges
_ <- traverse (addNode graph) g.nodes
_ <- traverse (addEdge graph) g.edges
pure graph
where
nodes = A.fromFoldable g.nodes
edges = A.fromFoldable g.edges
addNode :: Graph -> Record Types.Node -> Effect String
addNode g node@{ id } = runEffectFn3 _addNode g id node
......
......@@ -2,13 +2,14 @@ module Gargantext.Utils where
import Prelude
import Data.Array as A
import Data.Char (fromCharCode)
import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldr)
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype, unwrap, wrap)
import Data.Sequence.Ordered as OSeq
--import Data.Sequence.Ordered as OSeq
import Data.Set (Set)
import Data.Set as Set
import Data.String as S
......@@ -100,7 +101,8 @@ sortWith :: forall a b f. Functor f =>
Unfoldable f =>
Ord b =>
(a -> b) -> f a -> f a
sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty
--sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty
sortWith f xs = A.toUnfoldable $ A.sortWith f (A.fromFoldable xs)
href :: Effect String
......
module Data.Sequence where
import Prelude
import Data.Array as A
import Data.Functor as Functor
import Data.Tuple (Tuple(..))
type Seq = Array
cons = A.cons
length = A.length
concatMap = A.concatMap
drop = A.drop
filter = A.filter
map = Functor.map
take = A.take
fromFoldable = A.fromFoldable
toUnfoldable = A.toUnfoldable
empty = []
head = A.head
null = A.null
snoc = A.snoc
singleton = A.singleton
splitAt idx seq = Tuple s.before s.after
where
s = A.splitAt idx seq
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