[ngrams] remove ngramsValidPatch from state

parent 09b2a0e7
Pipeline #4586 failed with stage
in 0 seconds
...@@ -35,7 +35,6 @@ initialState ...@@ -35,7 +35,6 @@ initialState
initialState {loaded: {ngramsTable: Versioned {version}}} = initialState {loaded: {ngramsTable: Versioned {version}}} =
{ ngramsLocalPatch: mempty { ngramsLocalPatch: mempty
, ngramsStagePatch: mempty , ngramsStagePatch: mempty
, ngramsValidPatch: mempty
, ngramsSelection : mempty , ngramsSelection : mempty
, ngramsVersion: version , ngramsVersion: version
} }
......
...@@ -93,7 +93,6 @@ initialState = ...@@ -93,7 +93,6 @@ initialState =
{ ngramsLocalPatch: mempty { ngramsLocalPatch: mempty
, ngramsSelection: mempty , ngramsSelection: mempty
, ngramsStagePatch: mempty , ngramsStagePatch: mempty
, ngramsValidPatch: mempty
, ngramsVersion: 0 , ngramsVersion: 0
} }
......
...@@ -340,7 +340,6 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt ...@@ -340,7 +340,6 @@ renderNgramsItemCpt = here.component "renderNgramsItem" cpt
tbl :: NgramsTable tbl :: NgramsTable
tbl = applyNgramsPatches { ngramsLocalPatch tbl = applyNgramsPatches { ngramsLocalPatch
, ngramsStagePatch: mempty , ngramsStagePatch: mempty
, ngramsValidPatch: mempty
, ngramsVersion: 0 } ngramsTable , ngramsVersion: 0 } ngramsTable
getNgramsChildren' :: NgramsTerm -> Array NgramsTerm getNgramsChildren' :: NgramsTerm -> Array NgramsTerm
getNgramsChildren' n = A.fromFoldable $ ngramsChildren n getNgramsChildren' n = A.fromFoldable $ ngramsChildren n
......
...@@ -362,8 +362,8 @@ applyNgramsTablePatch (NgramsTablePatch ngramsPatches) (NgramsTable m) = ...@@ -362,8 +362,8 @@ applyNgramsTablePatch (NgramsTablePatch ngramsPatches) (NgramsTable m) =
applyPatchMap applyNgramsPatch ngramsPatches m.ngrams_repo_elements } applyPatchMap applyNgramsPatch ngramsPatches m.ngrams_repo_elements }
applyNgramsPatches :: forall s. CoreState s -> NgramsTable -> NgramsTable applyNgramsPatches :: forall s. CoreState s -> NgramsTable -> NgramsTable
applyNgramsPatches {ngramsLocalPatch, ngramsStagePatch, ngramsValidPatch} = applyNgramsPatches { ngramsLocalPatch, ngramsStagePatch } =
applyNgramsTablePatch (ngramsLocalPatch <> ngramsStagePatch <> ngramsValidPatch) applyNgramsTablePatch ( ngramsLocalPatch <> ngramsStagePatch )
-- First the valid patch, then the stage patch, and finally the local patch. -- First the valid patch, then the stage patch, and finally the local patch.
{- {-
...@@ -436,9 +436,7 @@ syncPatches props state callback = do ...@@ -436,9 +436,7 @@ syncPatches props state callback = do
s { s {
ngramsLocalPatch = fromNgramsPatches mempty ngramsLocalPatch = fromNgramsPatches mempty
, ngramsStagePatch = fromNgramsPatches mempty , ngramsStagePatch = fromNgramsPatches mempty
, ngramsValidPatch = fromNgramsPatches mempty -- First the local patch, then the newly received newPatch.
-- , ngramsValidPatch = fromNgramsPatches newPatch <> ngramsLocalPatch <> s.ngramsValidPatch
-- First the already valid patch, then the local patch, then the newly received newPatch.
, ngramsVersion = newVersion , ngramsVersion = newVersion
}) state }) state
here.log2 "[syncPatches] ngramsVersion" newVersion here.log2 "[syncPatches] ngramsVersion" newVersion
...@@ -449,7 +447,6 @@ syncPatchesAsync :: forall p s. CoreParams p -> R.State (CoreState s) -> (Unit - ...@@ -449,7 +447,6 @@ syncPatchesAsync :: forall p s. CoreParams p -> R.State (CoreState s) -> (Unit -
syncPatchesAsync props@{ listIds, tabType } syncPatchesAsync props@{ listIds, tabType }
({ ngramsLocalPatch: ngramsLocalPatch@{ ngramsPatches } ({ ngramsLocalPatch: ngramsLocalPatch@{ ngramsPatches }
, ngramsStagePatch , ngramsStagePatch
, ngramsValidPatch
, ngramsVersion , ngramsVersion
} /\ setState) callback = do } /\ setState) callback = do
when (isEmptyNgramsTablePatch ngramsStagePatch) $ do when (isEmptyNgramsTablePatch ngramsStagePatch) $ do
...@@ -463,8 +460,7 @@ syncPatchesAsync props@{ listIds, tabType } ...@@ -463,8 +460,7 @@ syncPatchesAsync props@{ listIds, tabType }
s { s {
ngramsLocalPatch = fromNgramsPatches mempty ngramsLocalPatch = fromNgramsPatches mempty
, ngramsStagePatch = fromNgramsPatches mempty , ngramsStagePatch = fromNgramsPatches mempty
, ngramsValidPatch = fromNgramsPatches newPatch <> ngramsLocalPatch <> s.ngramsValidPatch -- First the local patch, then the newly received newPatch.
-- First the already valid patch, then the local patch, then the newly received newPatch.
, ngramsVersion = newVersion , ngramsVersion = newVersion
} }
here.log2 "[syncPatches] ngramsVersion" newVersion here.log2 "[syncPatches] ngramsVersion" newVersion
...@@ -526,7 +522,6 @@ coreDispatch _ state (CommitPatch pt) = ...@@ -526,7 +522,6 @@ coreDispatch _ state (CommitPatch pt) =
coreDispatch _ state ResetPatches = coreDispatch _ state ResetPatches =
T.modify_ (_ { ngramsLocalPatch = mempty :: NgramsTablePatch T.modify_ (_ { ngramsLocalPatch = mempty :: NgramsTablePatch
, ngramsSelection = mempty :: Set NgramsTerm , ngramsSelection = mempty :: Set NgramsTerm
-- , ngramsValidPatch = mempty :: NgramsTablePatch
}) state }) state
isSingleNgramsTerm :: NgramsTerm -> Boolean isSingleNgramsTerm :: NgramsTerm -> Boolean
......
...@@ -507,8 +507,6 @@ type CoreState s = ...@@ -507,8 +507,6 @@ type CoreState s =
, ngramsStagePatch :: NgramsTablePatch , ngramsStagePatch :: NgramsTablePatch
-- ^ These patches are staged (scheduled for synchronization). -- ^ These patches are staged (scheduled for synchronization).
-- Requests are being performed at the moment. -- Requests are being performed at the moment.
, ngramsValidPatch :: NgramsTablePatch
-- ^ These patches have been synchronized with the server.
, ngramsVersion :: Version , ngramsVersion :: Version
| s | s
} }
......
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