timhall / svelte-apollo

Svelte integration for Apollo GraphQL
MIT License
947 stars 68 forks source link

How to update child component query when its sibling child component does a mutation? #54

Closed AnnieTaylorCHEN closed 3 years ago

AnnieTaylorCHEN commented 4 years ago

Hi so I have two child component Cart and Orders in parent component App

Cart have mutations with variables A, B, C. In the example we have : $: books.refetch({A, B, C }); but $books query are also in the same component. After this I want its sibling Order to update the orders.

How could I communicate between them?

timhall commented 3 years ago

Sorry for the late reply, basically you should either store the state in the parent App component or if they're not direct descendants then you could use svelte's context API