-
Notifications
You must be signed in to change notification settings - Fork 28
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
FR: allow to specify different fragments for list and detail view #40
Comments
🎉 This issue has been resolved in version 4.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Ok, so this is my fault for not testing this feature thoroughly and I am very sorry. I mentioned in my PR that I haven't actually tested this functionality in actual After playing with it in an actual application, it turns out there's a big catch in using it. React Admin uses optimistic rendering by default, i.e. it automatically caches all responses from So if we use different fragment for
Practically it means, that we have to treat every field that isn't common among any used fragments (since we can have multiple resource views on the same resource, and even those can be split into Technically it still works as it should but I think it at least needs a mention in the README. Or do you think we should revert the change as it technically worked with a single fragment (as the cached response would be the same shape whether for |
no worries! thank you for the details analysis. I would not revert it right now, but some thoughts and questions:
they have then a different name, right? if i remember correctly, we treat these "virtual" resource views like different resources, so they appear different for react-admin and therefore do not share the same place in the redux store. So the problem only refers to list and detail view, i guess |
From a light digging through their issues (here and here) it doesn't look like we can disable this caching, they don't want to support it as it's a design decision and frankly I am a little afraid of this particular sentence
I'm afraid that I'm just missing some behavior where this breaks again as I'm not very familiar with the insides of the framework (been only working with it for about a month and a half). To answer your questions:
|
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
with the option
resourceViews
you can specify a custom fragment that will be used to fetch records. But it will be used for both list and detail view. it would be nice if you could specify a different fragment for detail and list view.Proposal:
the
fragment
option for resource view could either be one fragment or an object withi would use one and many because it aligns with the internal fetch types of react admin
The text was updated successfully, but these errors were encountered: