Skip to content

Select fires on unrelated store changes. #556

@DejayJD

Description

@DejayJD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions