Skip to content
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

No read function for parent types #9815

Closed
kelvin2200 opened this issue Jun 12, 2022 · 7 comments
Closed

No read function for parent types #9815

kelvin2200 opened this issue Jun 12, 2022 · 7 comments
Labels

Comments

@kelvin2200
Copy link

Hello everybody,

I can’t seem to find a way to read an entire type without having to resort to individual fieldPolicies for every field in that type.

const cache = new InMemoryCache({
    typePolicies: {
        SomeType: {
            fields:{
                // defining individual field (READ) policies would be insane (at least for my case)
                // is there at least something like a wildcard mechanism?
            },
            merge, // yeah... possible at type level
            read // ??? not possible, so... Is there any other way to do this?
            // I want to be able to return a different ref based on some condition
        }
    }
})
@jpvajda
Copy link
Contributor

jpvajda commented Jun 17, 2022

Thank you for reporting this! you can try posting this in our Apollo Community for guidance from other Apollo users, as other's may have input into your question. I'll leave this open here a well to see if anyone has any ideas.

@bignimbus
Copy link
Contributor

Hi @kelvin2200 👋🏻 just going through some old issues and this one came up - I know it's almost two years later but please let us know if there's anything we can do to help. I don't think there's a built-in API for doing what you're doing, but maybe if we knew more about your use case we could suggest a way to use existing APIs to achieve what you're trying to do. Let me know!

@bignimbus bignimbus added the 🏓 awaiting-contributor-response requires input from a contributor label Apr 25, 2024
@kelvin2200
Copy link
Author

Well, I guess it's better late than never, and I'm not dead yet, which is good.

Thank you for your reply @bignimbus, but the problem is a bit more complex, and the fact that nobody chose to tackle this, says something.

For a more detailed explanation, i've provided one in the apollo community, which is as old as this one, and still without answer.

I really doubt anybody has an answer, or is willing to provide one

@bignimbus
Copy link
Contributor

@bignimbus
Copy link
Contributor

Will close this issue and re-route conversation to the thread above. Thanks!

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants