• Przemyslaw Kaminski's avatar
    [ngrams] fixes to ngrams state synchronization · 09b2a0e7
    Przemyslaw Kaminski authored
    The issue was this:
    
    When user clicks around the ngrams table, only local state is
    updated (`ngramsLocalPatch`). After he clicks 'Sychronize', this is
    uploaded to server and `ngramsVersion` number is bumped up. What
    happened is that `ngramsValidPatch` inside internal state was updated
    and so the patch was sychronized locally, without refreshing the
    table. However, this resulted in errors later, when user changed the
    same term, because then, when user changes view to 'Stop terms', the
    table is refreshed with the newly applied terms and `ngramsValidPatch`
    doesn't make sense anymore.
    
    The solution is to set `ngramsValidPatch` to `mempty` and, after state
    is updated, refresh the current table.
    
    It could be argued whether it's the most optimal thing to do and why
    don't we keep things "offline". Well, clicking on 'Sychronize'
    requires the client to be online so why not sync the table already at
    this time?
    
    I guess this makes things bit simpler and I think it renders
    `ngramsValidPatch` unnecessary. So our state could be
    simplified (patches is already a complex beast).
    09b2a0e7
Name
Last commit
Last update
.psc-package/local/.set Loading commit data...
ci-tests Loading commit data...
dist Loading commit data...
nix Loading commit data...
prod Loading commit data...
specs Loading commit data...
src Loading commit data...
test Loading commit data...
tests Loading commit data...
.babelrc Loading commit data...
.envrc Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.yarnrc Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
Dockerfile.dev Loading commit data...
LICENSE Loading commit data...
REACTIX.md Loading commit data...
README.md Loading commit data...
default.nix Loading commit data...
docker-compose.yml Loading commit data...
docker-env.sh Loading commit data...
env.sh Loading commit data...
index.html Loading commit data...
install Loading commit data...
manifest.json Loading commit data...
metadata.json Loading commit data...
package.json Loading commit data...
packages.dhall Loading commit data...
packages.json Loading commit data...
psc-package.json Loading commit data...
repl Loading commit data...
shell.nix Loading commit data...
spago.dhall Loading commit data...
test.dhall Loading commit data...
yarn.lock Loading commit data...