Skip to content

Jotai Apollo: atomsWithQuery within react tree #11

@yassuge

Description

@yassuge

Hi Mo,

Currently, I'm working with the RedwoodApolloProvider and I'm finding
the use of the useApolloClient hook quite valuable for obtaining the
client. However, I've encountered a situation where I'm uncertain
about the best approach to handle it.

As far as I understand, Redwood doesn't offer a seamless method to
define the client outside of the React tree and then pass it to the
provider. This leads me to call atomsWithQuery from within the React
tree itself (to avoid calling hook for the client from outside the render function), as it requires the client to function properly. I'm
wondering if this pattern is supported or if you have any experience
with it. If so, I would greatly appreciate any insights or examples
you might have.

I've attempted a few methods, such as making a plain call (which
triggered infinite rerendering) and using useMemo (which didn't update
with new data), but I haven't found the ideal solution yet.

Thanks in advance for your assistance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions