[ngrams] ngramsValidPatch put to appropriate use

For ngrams table, we set ngramsValidPatch = mempty because the table
is refreshed and we have issue
#594

However, we need to keep that field, it turns out, because we have
#598

Recently applied patches are needed for the document ngrams
highlighting.

This all would be unnecessary (or at least moved to the backend) if we
had
#553
parent 77ad2d50
Pipeline #4636 failed with stage
in 0 seconds
......@@ -35,7 +35,6 @@ import Gargantext.Sessions (Session)
import Gargantext.Utils ((?))
import Gargantext.Utils as U
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
......@@ -93,9 +92,9 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- Component
cpt { contextNgrams
, loaded:
loaded@{ ngramsTable: Versioned { data: initTable }
, document: NodePoly { hyperdata: Document doc }
}
loaded@{ ngramsTable: Versioned { data: initTable }
, document: NodePoly { hyperdata: Document doc }
}
, path
, sideControlsSlot
} _ = do
......@@ -118,6 +117,7 @@ layoutWithContextNgramsCpt = here.component "layoutWithContextNgrams" cpt where
-- here.log2 "[layout] contextNgrams" contextNgrams
-- here.log2 "[layout] contextNgrams'" contextNgrams'
-- here.log2 "[layout] state'" state'
-- here.log2 "[layout] ngrams'" ngrams'
mode' /\ mode <- R2.useBox' AFT.EditionMode
......
......@@ -436,8 +436,8 @@ syncPatches props state callback = do
s {
ngramsLocalPatch = fromNgramsPatches mempty
, ngramsStagePatch = fromNgramsPatches mempty
, ngramsValidPatch = fromNgramsPatches mempty
-- , ngramsValidPatch = fromNgramsPatches newPatch <> ngramsLocalPatch <> s.ngramsValidPatch
-- , ngramsValidPatch = fromNgramsPatches mempty
, ngramsValidPatch = fromNgramsPatches newPatch <> ngramsLocalPatch <> s.ngramsValidPatch
-- First the already valid patch, then the local patch, then the newly received newPatch.
, ngramsVersion = newVersion
}) state
......@@ -526,7 +526,7 @@ coreDispatch _ state (CommitPatch pt) =
coreDispatch _ state ResetPatches =
T.modify_ (_ { ngramsLocalPatch = mempty :: NgramsTablePatch
, ngramsSelection = mempty :: Set NgramsTerm
-- , ngramsValidPatch = mempty :: NgramsTablePatch
, ngramsValidPatch = mempty :: NgramsTablePatch
}) state
isSingleNgramsTerm :: NgramsTerm -> Boolean
......
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