convoyinc / apollo-cache-hermes

A cache implementation for Apollo Client, tuned for performance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement or document dataIdFromObject

cmbirk opened this issue · comments

It would be useful for apollo-cache-hermes to allow a different cache key other than id on a given object. In-memory-cache uses dataIdFromObject that can be read about in their normalization documentation here: https://www.apollographql.com/docs/react/advanced/caching/#normalization

We have used that function to determine different cache keys by __typename.

👋 I would be willing to help implement this feature or document it if it currently exists, but will need some guidance from your team.

I didn't see this on your roadmap, but is this something you would be willing to add?

You're in luck! It's something we support today 💪. You can customize the id behavior by passing the entityIdForNode configuration option when instantiating the cache

Perfect, thanks! I'll open a PR to update the readme with instructions.

why not support dataIdFromObject so conversion from inmemory is without changes? Isn't it just an alias?