• Robert Knight's avatar
    Convert store selectors to receive local rather than global state · 5250a6f7
    Robert Knight authored
    Change store module selectors to receive the module's local state rather than
    the global/root state as the first argument. The majority of selectors only need
    access to the module's local state. Changing these selectors to receive the
    local rather than root state has benefits:
    
     - It avoids the need for the selectors to know about the structure of
       the root state. This can make future refactorings and re-use easier.
    
     - It is consistent with how state is accessed in the reducer functions
    
     - It will simplify typing selectors because the type of the `state`
       argument will be the same as the type of `state` returned by `init`
       and passed to `update` functions
    
     - It potentially enables automatic memoization of selectors based on
       the local state. ie. If the local state for a module has not changed as a
       result of an action, then none of the local selectors will need to be
       recomputed
    
    There are a small number of selectors that need access to state from
    multple modules. In future we may want to move these to some separate
    location but, as an incremental step, add support for "root selectors"
    to modules under a `rootSelectors` key. These selectors will still receive the
    root state as their first argument as before.
    
    This commit also adds missing tests for the `annotationExists` selector and the
    `route` module.
    
    See also https://hypothes-is.slack.com/archives/C1M8NH76X/p1595237570226700.
    5250a6f7
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.prettierrc Loading commit data...
.python-version Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
codecov.yml Loading commit data...
gulpfile.js Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
tox.ini Loading commit data...
yarn.lock Loading commit data...