We added UpdateEventData that had the latest information in order to populate the data with since it was returning response in which structure of response might not match what React Query expects. We then used UpdateEventData in the onSuccess function and switched it from invalidateQueries to setQueryData so we update the corresponding query in the React Query cache.
Testing
We created a fake event calling Testing event bug that allowed us to experiment and test our code with the edit event function. We also created console.log comments to for updatedEventData to see if the right data was being passed through.
Summary
We added UpdateEventData that had the latest information in order to populate the data with since it was returning response in which structure of response might not match what React Query expects. We then used UpdateEventData in the onSuccess function and switched it from invalidateQueries to setQueryData so we update the corresponding query in the React Query cache.
Testing
We created a fake event calling Testing event bug that allowed us to experiment and test our code with the edit event function. We also created console.log comments to for updatedEventData to see if the right data was being passed through.
Notes