Commit c0b777db authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[docsTable] fix cache on/off changing

parent cd2cefc4
...@@ -77,6 +77,7 @@ type PageLayoutProps = ( ...@@ -77,6 +77,7 @@ type PageLayoutProps = (
cacheState :: R.State NT.CacheState cacheState :: R.State NT.CacheState
, corpusId :: Maybe Int , corpusId :: Maybe Int
, frontends :: Frontends , frontends :: Frontends
, key :: String -- NOTE Necessary to clear the component when cache state changes
, listId :: Int , listId :: Int
, nodeId :: Int , nodeId :: Int
, params :: T.Params , params :: T.Params
...@@ -217,6 +218,7 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt where ...@@ -217,6 +218,7 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt where
[ pageLayout { cacheState [ pageLayout { cacheState
, corpusId , corpusId
, frontends , frontends
, key: show $ fst cacheState
, listId , listId
, nodeId , nodeId
, params , params
...@@ -508,7 +510,7 @@ tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchTyp ...@@ -508,7 +510,7 @@ tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchTyp
lmt = queryParam "limit" limit lmt = queryParam "limit" limit
lst = queryParam "list" listId lst = queryParam "list" listId
ofs = queryParam "offset" offset ofs = queryParam "offset" offset
odb = maybe "" (\o -> "orderBy=" <> (T.orderByToForm o)) orderBy odb = mQueryParamS "orderBy" T.orderByToForm orderBy
st = queryParam "searchType" searchType st = queryParam "searchType" searchType
tt = queryParamS "tabType" (showTabType' tabType) tt = queryParamS "tabType" (showTabType' tabType)
q = queryParamS "query" query q = queryParamS "query" query
......
...@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Lists.Types where ...@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Lists.Types where
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq) import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Gargantext.Prelude import Gargantext.Prelude
...@@ -12,3 +13,5 @@ data CacheState = CacheOn | CacheOff ...@@ -12,3 +13,5 @@ data CacheState = CacheOn | CacheOff
derive instance genericCacheState :: Generic CacheState _ derive instance genericCacheState :: Generic CacheState _
instance eqCacheState :: Eq CacheState where instance eqCacheState :: Eq CacheState where
eq = genericEq eq = genericEq
instance showCacheState :: Show CacheState where
show = genericShow
...@@ -16,7 +16,7 @@ mQueryParam :: forall a. Show a => String -> Maybe a -> String ...@@ -16,7 +16,7 @@ mQueryParam :: forall a. Show a => String -> Maybe a -> String
mQueryParam _ Nothing = "" mQueryParam _ Nothing = ""
mQueryParam key (Just v) = queryParam key v mQueryParam key (Just v) = queryParam key v
mQueryParamS :: String -> (String -> String) -> Maybe String -> String mQueryParamS :: forall a. String -> (a -> String) -> Maybe a -> String
mQueryParamS _ _ Nothing = "" mQueryParamS _ _ Nothing = ""
mQueryParamS key mFunc (Just v) = queryParamS key $ mFunc v mQueryParamS key mFunc (Just v) = queryParamS key $ mFunc v
......
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