Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select fires on unrelated store changes. #556

Open
3 of 9 tasks
DejayJD opened this issue Apr 9, 2019 · 0 comments
Open
3 of 9 tasks

Select fires on unrelated store changes. #556

DejayJD opened this issue Apr 9, 2019 · 0 comments

Comments

@DejayJD
Copy link

DejayJD commented Apr 9, 2019

This is a...

  • feature request
  • bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version: v10.10.0
Typescript Version: 3.1.1
Angular Version: 7.0.0
@angular-redux/store version: ^9.0.0
@angular/cli version: (if applicable) ~7.0.4
OS: Mac High Sierra

Actual Behaviour:

Any update to a store will trigger another round of .select, even if that specific data has not changed.
For example:
ngRedux.select(['MyStore', 'myData']).subscribe(....) with the following states:
State 0:

{ //Root
	MyStore: {
		myData:{data:null},
		someOtherData:{data:null}
	}
}

State 1 - triggers select to fire (expected, since myData has been updated):

{ //Root
	MyStore: {
		myData:{data:"SomeData"},
		someOtherData:{data:null}
	}
}

State 2 - triggers select to fire (unexpected, since myData has not been updated):

{ //Root
	MyStore: {
		myData:{data:"SomeData"},
		someOtherData:{data:"OtherDataUpdated"}
	}
}

Expected Behaviour:

ngRedux.select(['MyStore', 'myData']).subscribe(....) should only fire subscriptions when there are changes to myData not changes to MyStore overall.
In the example above, State 2 should not trigger my subscription.

Additional Notes:

I'm marking this as both a usage question and a bug because I'm not sure if this is just an issue with the store as a whole, or if there is some way I need to have configured my store or I can be doing something different in my implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant