score:1
my solution was to pass the refetch method of the query component to the form component and call refetch() on completion of the mutation.
in the parent component:
<query query={invoices_query} variables={{ orderby: 'date_desc' }}>
{({ data, loading, refetch }) => {
if (loading) return <loading />;
inside the form component:
<mutation mutation={create_invoice}
oncompleted={() => {
this.props.invoicesubmitted();
this.props.refetch();
}}
>
score:3
i believe that the query component render prop has a refetch method. you can then pass this down and call it as needed.
<query query={invoices_query} variables={{ orderby: 'date_desc' }} >
{({ data, loading, refetch }) => {
...
<form onsubmit={() => refetch()} />
...
}}
</query>
https://www.apollographql.com/docs/react/data/queries/#refetching
Source: stackoverflow.com
Related Query
- How to refresh graphql query in parent component after a form is submitted in a child component?
- How can I refresh a list in one component after form submit in another component that shares same parent?
- How to update the Redux store after Apollo GraphQL query returns
- How to force Apollo Query component to re-run query when parent component re-renders
- How to show Error or Validation messages only after form is submitted and not when user is typing in antd?
- How to Stop component to refresh after axios post in react. After uploading image from formData
- How to pass graphQL query variable into a decorated react component
- How to pass Child Component's form value to Parent Component
- React-redux: How to bubble up redux form props to parent component
- How to pass form values from child component to parent in react
- How to pass input values from a child Form component to the state of its parent component for submission with react hooks?
- How to rerender parent component after receiving child's ref with useRef hook?
- how to pass a child component's validated data (as a formik form) to its parent component and handle form submission in parent
- How to call method in child component only once after parent state update
- react, gatsby - how to access GraphQL query data in react class component
- How do i make the data in the input feild of my form in next js stay after refresh of the page?
- How can I render Parent component again after update from the child component
- How to handle the props from Parent Component to child component to populate props data in the form for updation
- How to get a value form a child component to a parent component in reactjs?
- How to access data in child component of query called in parent component in rtk query?
- How should I update data in child component which I sent form parent via props
- How can reset a React child component back to original state after it updates state in the parent
- How do I redirect to a new component after form onSubmit?
- How to refresh list after successfully created post in react redux form
- How can I push my react form data to a dynamic API query in another component
- How to make a GraphQL lazy query with Apollo client after the first query is successful
- refresh the comment list after form submitted
- How to pass data from parent component to child after creation of child?
- How to disable a submit button in redux form for the second time after the form is submitted for the first time?
- How do I pass the props from this child component to the parent form
More Query from same tag
- multi select reactjs handlechange
- How to set a default sorting in a react table?
- How to give multiple properties to react component in shorter way?
- How do I connect web API to a react project through AJAX?
- Unexpected end of JSON input on Promise resolve
- I need to pass a URL from a class component to another
- Transpiled code gives TypeError:is not a constructor
- How to use react-router-redux routeActions?
- Multiple child components call action from 1 to another
- Apply onClick functions based on conditions within components React
- Responsive Navigation Not Working (React)
- React get value of object from localstorge
- Problems updating single product price reactjs/redux
- How to convert an object into an array of objects?
- React this.props.id is undefined in part of class
- Uncaught (in promise) Error: Request failed with status code 404 when going to the profile
- How to get full height (including margins) with window.getComputedStyle()?
- Saving object in React.useState
- React: Incorrect Modal component gets rendered called after axios call
- React Testing Library: Unable to Select Material UI DatePicker Button
- Firebase firestore server timestamp without importing all of firebase to my web project?
- error when installing react-to-pdf package
- Const empty object causes infinite re-render
- Cannot read property 'map' of undefined when selecting dropdown options from array in useEffect
- how to map through json object in javascript?
- Graphql query returns null id in mongodb aggregation
- how can we access and get props that are passed to a component (wrapper.props().propname) always return undefined
- ReactJS bootstrap form without refreshing page
- Server side searching in React
- Refetch queries after Mutation doesn't work