Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With apollo client how do you set loading status on mutation refetchQueries?

So I'm adding to an object's list with a mutation using the apollo client. Say I have an event and I'm adding participants and i'm using refetchQueries to get the refreshed event with participants on the details screen. Unfortunately I'm not getting a data.loading == true status during this refetch, making it likely that the user will keep hitting that join participant button repeatedly.

<Button styleName="dark full-width" onPress={()=> {
            this.props.joinEvent({
                variables: { eventId: Event.id, userId: user.id },
                refetchQueries: ['getEvent'],
              });
              // how do I trigger the data.loading = true like it does during the initial fetch?
          }
        }>
like image 567
MonkeyBonkey Avatar asked Oct 16 '25 05:10

MonkeyBonkey


1 Answers

use awaitRefetchQueries:true, it will wait until refetch query resolves awaitRefetchQuery

like image 176
Nitin Sindhe Avatar answered Oct 19 '25 13:10

Nitin Sindhe