-
Notifications
You must be signed in to change notification settings - Fork 330
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
About caching and reusing data in stores #180
Comments
I've tried to put my reasonings in this gist. The case is related to Combine results React getInitialState and Reflux getInitialState #166 and may be a case for server-rendering #144? (I know @appsforartists has made progress but i'm still some steps behind :-) ) |
@gpbl I use sessionStorage on this small app - https://github.com/simonsmith/github-user-search I decided to allow the actions to read from the cache and let the stores save to the cache. When calling the Hope that helps |
I'm quite curious about the preferred approach here as well. |
I personally think, that only store should be concerned with data retrieval. |
In order to clean up the issue tracker I have to close down all questions. Please use proper communications channels for questions about reflux, such as:
|
Now that v0.2.2 provides a nicer API for loading asynchronous data, I want to place my API requests in
actions
. Yet I'm not sure how to reuse data already cached in the stores.(I'm sorry if you have already discussed this thing before, maybe I've lost the discussion somewhere. Also, I miss a gitter chat :-)
Before, i had my stores managing this:
I was tempted to do something like this:
but this won't work, since
actions
is required fromstore
as well, causing a circular dependency.I solved putting the logic in the component:
I prefer this approach because:
– a possible
loading
state is managed from the component and not the store– my
getData()
function could receive an argument with the fields I need from my data (in case of the data is available but incomplete)Does this sound right or have you found a better approach?
The text was updated successfully, but these errors were encountered: