-
Notifications
You must be signed in to change notification settings - Fork 16
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
gotInstanceData
method wiring is missing from the data/callbacks behavior
#301
Comments
The reference you see to The docs for I'll report back if we have a timeline for adding a |
@pmgmendes or ... submit a pull request with it fixed and we can have a release out immediately :-) |
@justinbmeyer So it should be there? Yeah, I'll do it. |
yeah, should be there. Btw, what are you using it for? |
I'm accessing a resource modeled as
This is a resource that returns only static data from the server (but might change after new re-deploys) and I want to cache the response in localStorage but the returned map doesn't have a unique identifier. So I've created the instance type as a define map with the following props
And in
This way I can make use of the behaviors that use instanceStore too. |
@justinbmeyer I've added the
Should real-time implement |
For this use case, would parse-data do what you need?
…Sent from my iPhone
On Jun 6, 2017, at 4:03 PM, Pedro Mendes ***@***.***> wrote:
I'm accessing a resource modeled as /api/resource/{id} which returns a simple key value map
{ "keyA": "valueA", "keyB": "valueB", ... }
This is a resource that returns only static data from the server (but might change after new re-deploys) and I want to cache the response in localStorage but the returned map doesn't have a unique identifier. So I've created the instance type as define map with props
{
id: "string",
data: {}
}
And in gotInstanceData I intend to do something like
gotInstanceData: (response, params) => {
return {
id: params.id
data: response
}
}
This way I can make use of the behaviors that use instanceStore too.
It might appear that I could be better off using cacheRequests behavior but I still want to perform those requests to the server so I'm using fallThroughCache strategy.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I need the request params and parseData just provides the response data.
|
Good to hear @pmgmendes! If you want to open a PR for your branch I can help you resolve the problems you're having with the tests. I suspect the issue you're seeing is due to the test for the |
How often can you reproduce it?
Description:
Although the documentation can-connect references a callback named
gotData
this method is not being wired togetData
in the data/callbacks pairs so it can be overwritten by other behaviors.The pairs object in can-connect/data/callbacks/callbacks.js is expected to also have
The text was updated successfully, but these errors were encountered: