Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The state always contains the complete state of all stores ?

See original GitHub issue


  this.subs.sink = this.auctionsStoreService.stateChanged.subscribe(
         (state: AuctionState) => {

state contains all data from all other stores und not just the data that is related to auctions ? is that the expected behavior ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

DanWahlincommented, Dec 20, 2019

Good deal. That’s typically how I organize the store structure as well.

As far as stateWithPropertyChanges, it fires when setState() is called by the given service (assuming there’s a subscriber) and passes the state that was set as the second parameter. Since you can’t set a nested property directly (due to having to go through the parent property), it won’t be able to pass a nested property that changed when stateWithPropertyChanges fires since there could be several properties that could change all at once.

For example, customer.firstName and customer.lastName could be set together. The customer value would therefore be passed to the subscriber of stateWithPropertyChanges. If you need to compare nested properties then you’d need to compare before and after values wherever you subscribe to stateWithPropertyChanges.

roger-glcommented, Dec 19, 2019

Thanks again for the answer. I now started to give the store more structure by having a property for each service (customer, orders and so on). Which that approach I feel much more comfortable. The only problem so far is, that stateWithPropertyChanges does not work for nested properties.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to choose between Redux's store and React's state ...
Use React for ephemeral state that doesn't matter to the app globally and doesn't mutate in complex ways. For example, a toggle in...
Read more >
Redux Fundamentals, Part 3: State, Actions, and Reducers
The official Redux Fundamentals tutorial: learn how reducers update state in response to actions.
Read more >
UseState shows previous value always - Stack Overflow
I'm trying to update the state variable using hooks and trying it read the updated value but always it returns a previous value...
Read more >
Persist Redux State with redux-persist - DEV Community ‍ ‍
It is a package for persisting redux state when it is connected to the store. That's all what the package does. Pretty neat!...
Read more >
Hooks API Reference - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found