Skip to content

cache the subsets of a collection when the other parts changes cause the collection reference change#217

Closed
dingchaoyan1983 wants to merge 4 commits into
reduxjs:masterfrom
dingchaoyan1983:master
Closed

cache the subsets of a collection when the other parts changes cause the collection reference change#217
dingchaoyan1983 wants to merge 4 commits into
reduxjs:masterfrom
dingchaoyan1983:master

Conversation

@dingchaoyan1983
Copy link
Copy Markdown

There is one case, like below:

let arr = [a, b, c, d];

const selector = createSelector(
     arr => arr,
     (list) => list.filter((item) => item.type === 'a'));

const sub = selector({arr: arr});

we create a selector which is depend an array, and this selector will filter out the subset which type is a, but if the element of other type b has been changed, because the immutable, we will generate a new array, but the inner elements is the same as before except the changed one, so if we use the same selector it will output a new subset, but the inner element is same, so we want to use the cached subset at this time. we want to cut off the selectors change chain.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling d54607a on dingchaoyan1983:master into 1143dcb on reactjs:master.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling d54607a on dingchaoyan1983:master into 1143dcb on reactjs:master.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 14, 2017

Codecov Report

Merging #217 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #217   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          12     14    +2     
=====================================
+ Hits           12     14    +2
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1143dcb...69cfaab. Read the comment docs.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 14, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 28de07c on dingchaoyan1983:master into 1143dcb on reactjs:master.

@coveralls
Copy link
Copy Markdown

coveralls commented Feb 14, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 69cfaab on dingchaoyan1983:master into 1143dcb on reactjs:master.

@markerikson
Copy link
Copy Markdown
Contributor

Superseded by #513 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants