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
ba9e3372
Commit
ba9e3372
authored
Feb 10, 2022
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] Cache off search issue
* #367
parent
7f7afc2d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
37 deletions
+42
-37
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+42
-37
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
ba9e3372
...
@@ -7,7 +7,6 @@ module Gargantext.Components.NgramsTable
...
@@ -7,7 +7,6 @@ module Gargantext.Components.NgramsTable
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.FunctorWithIndex (mapWithIndex)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Lens (to, view, (%~), (.~), (^.), (^?))
import Data.Lens (to, view, (%~), (.~), (^.), (^?))
import Data.Lens.At (at)
import Data.Lens.At (at)
...
@@ -255,7 +254,7 @@ type CommonProps =
...
@@ -255,7 +254,7 @@ type CommonProps =
( afterSync :: Unit -> Aff Unit
( afterSync :: Unit -> Aff Unit
, boxes :: Boxes
, boxes :: Boxes
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, withAutoUpdate :: Boolean
, withAutoUpdate :: Boolean
-- (?) not used
)
)
type PropsNoReload =
type PropsNoReload =
...
@@ -272,17 +271,6 @@ type Props =
...
@@ -272,17 +271,6 @@ type Props =
, reloadRoot :: T2.ReloadS
, reloadRoot :: T2.ReloadS
| PropsNoReload )
| PropsNoReload )
loadedNgramsTable :: R2.Component PropsNoReload
loadedNgramsTable = R.createElement loadedNgramsTableCpt
loadedNgramsTableCpt :: R.Component PropsNoReload
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
cpt props@{ path } _ = do
searchQuery <- T.useFocused (_.searchQuery) (\a b -> b { searchQuery = a }) path
pure $ R.fragment $
[ loadedNgramsTableHeader { searchQuery } []
, loadedNgramsTableBody props [] ]
type LoadedNgramsTableHeaderProps =
type LoadedNgramsTableHeaderProps =
( searchQuery :: T.Box SearchQuery )
( searchQuery :: T.Box SearchQuery )
...
@@ -312,7 +300,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
...
@@ -312,7 +300,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
, state
, state
, tabNgramType
, tabNgramType
, versioned: Versioned { data: initTable }
, versioned: Versioned { data: initTable }
, withAutoUpdate
} _ = do
} _ = do
state'@{ ngramsChildren, ngramsLocalPatch, ngramsParent, ngramsSelection } <- T.useLive T.unequal state
state'@{ ngramsChildren, ngramsLocalPatch, ngramsParent, ngramsSelection } <- T.useLive T.unequal state
path'@{ scoreType, termListFilter, termSizeFilter } <- T.useLive T.unequal path
path'@{ scoreType, termListFilter, termSizeFilter } <- T.useLive T.unequal path
params <- T.useFocused (_.params) (\a b -> b { params = a }) path
params <- T.useFocused (_.params) (\a b -> b { params = a }) path
...
@@ -565,14 +553,26 @@ mainNgramsTable = R.createElement mainNgramsTableCpt
...
@@ -565,14 +553,26 @@ mainNgramsTable = R.createElement mainNgramsTableCpt
mainNgramsTableCpt :: R.Component MainNgramsTableProps
mainNgramsTableCpt :: R.Component MainNgramsTableProps
mainNgramsTableCpt = here.component "mainNgramsTable" cpt
mainNgramsTableCpt = here.component "mainNgramsTable" cpt
where
where
cpt props@{ cacheState } _ = do
cpt props@{ cacheState, path } _ = do
searchQuery <- T.useFocused (_.searchQuery) (\a b -> b { searchQuery = a }) path
cacheState' <- T.useLive T.unequal cacheState
cacheState' <- T.useLive T.unequal cacheState
-- let path = initialPageParams session nodeId [defaultListId] tabType
-- let path = initialPageParams session nodeId [defaultListId] tabType
case cacheState' of
case cacheState' of
NT.CacheOn -> pure $ mainNgramsTableCacheOn props []
NT.CacheOn -> pure $ R.fragment
NT.CacheOff -> pure $ mainNgramsTableCacheOff props []
[
loadedNgramsTableHeader { searchQuery } []
,
mainNgramsTableCacheOn props []
]
NT.CacheOff -> pure $ R.fragment
[
loadedNgramsTableHeader { searchQuery } []
,
mainNgramsTableCacheOff props []
]
mainNgramsTableCacheOn :: R2.Component MainNgramsTableProps
mainNgramsTableCacheOn :: R2.Component MainNgramsTableProps
mainNgramsTableCacheOn = R.createElement mainNgramsTableCacheOnCpt
mainNgramsTableCacheOn = R.createElement mainNgramsTableCacheOnCpt
...
@@ -622,7 +622,6 @@ mainNgramsTableCacheOffCpt :: R.Component MainNgramsTableProps
...
@@ -622,7 +622,6 @@ mainNgramsTableCacheOffCpt :: R.Component MainNgramsTableProps
mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
cpt { afterSync
cpt { afterSync
, boxes
, boxes
, defaultListId
, path
, path
, tabNgramType
, tabNgramType
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
...
@@ -685,7 +684,10 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
...
@@ -685,7 +684,10 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
state <- T.useBox $ initialState versioned
state <- T.useBox $ initialState versioned
pure $ loadedNgramsTable { afterSync
pure $
loadedNgramsTableBody
{ afterSync
, boxes
, boxes
, cacheState
, cacheState
, mTotalRows: Nothing
, mTotalRows: Nothing
...
@@ -720,7 +722,10 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
...
@@ -720,7 +722,10 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
state <- T.useBox $ initialState versioned
state <- T.useBox $ initialState versioned
pure $ loadedNgramsTable { afterSync
pure $
loadedNgramsTableBody
{ afterSync
, boxes
, boxes
, cacheState
, cacheState
, mTotalRows: Just count
, mTotalRows: Just count
...
...
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