Commit c0b777db authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[docsTable] fix cache on/off changing

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