Loading relationship data in custom Cell component #1300
reiv
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 3 replies
-
I definitly see your point here. I think the way I would implement this would be pass any custom RelationshipCell components as children props and render it instead of the default template. That way instead of rendering only the default or the custom component, we'd render both and the same props would be passed through to the custom component. Does that make sense? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you have a relationship field and define a custom Cell component for it, that component will only receive the id of the related document, which isn't very useful on its own. The default
RelationshipCell
fetches the associated data with a form of request batching and involving an intersection observer to prevent loading off-screen data. It would be nice if it were possible to make use of this mechanism from custom Cell components as well so that you're not forced to write this kind of logic yourself. I see two possibilities here:RelationshipCell
data fetching logic in a hook and expose it asuseRelationship
or something like that (user would be responsible for passing the intersection ref)RelationshipCell
with a render prop that can be used by the custom Cell to display the related data in a different manner (intersection ref is already included)Beta Was this translation helpful? Give feedback.
All reactions