What is the definition of state?

(João Valente) #1

I’m having an existencial problem.

Imagine a system with repositories and issues with offline support: as you get remote data, it should be persisted in the localStorage.

Talking about pure Flux here.

Considering that it is a good practice to have your getState() not depending on props, I’m assuming that we should always keep all the issues in state and filter them at the React component level, based on the repository you are currently viewing (active_repository), given to you by the React router props.params.

To me, if feels somehow wrong to keep thousands of issues in the state while I may be operating on a repository which has only 3 issues. Moreover, bringing the filtering complexity to the component level sounds a bit strange to.

Should state be a representation of all the system’s data — a mirror of localStorage — or should state.issues be populated at the store level with the issues that concern the prop active_repository?

Hope this makes any sense.

Kinds regards,

(Igsem) #2

hmmm this looks somehow wrong…although not enough information but you should not keep the issues in the state…you should have in your store a repositories and issues section…and use a selector to get what you want