mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
refactor: force refetch after mutation
This commit is contained in:
@@ -32,6 +32,7 @@ import { useUploadModalContextStore } from './uploadModalContext';
|
|||||||
import { isExcelFile, isOntimeFile } from './uploadUtils';
|
import { isExcelFile, isOntimeFile } from './uploadUtils';
|
||||||
|
|
||||||
import style from './UploadModal.module.scss';
|
import style from './UploadModal.module.scss';
|
||||||
|
import { PROJECT_DATA, RUNDOWN_TABLE, USERFIELDS } from '../../../common/api/apiConstants';
|
||||||
|
|
||||||
export type UploadStep = 'upload' | 'review';
|
export type UploadStep = 'upload' | 'review';
|
||||||
|
|
||||||
@@ -132,7 +133,12 @@ export default function UploadModal({ onClose, isOpen }: UploadModalProps) {
|
|||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
try {
|
try {
|
||||||
await patchData({ rundown, userFields, project });
|
await patchData({ rundown, userFields, project });
|
||||||
await queryClient.invalidateQueries(['rundown', 'userFields', 'project']);
|
queryClient.setQueryData(RUNDOWN_TABLE, rundown);
|
||||||
|
queryClient.setQueryData(USERFIELDS, userFields);
|
||||||
|
queryClient.setQueryData(PROJECT_DATA, project);
|
||||||
|
await queryClient.invalidateQueries({
|
||||||
|
queryKey: [...RUNDOWN_TABLE, ...USERFIELDS, ...PROJECT_DATA],
|
||||||
|
});
|
||||||
doClose = true;
|
doClose = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = maybeAxiosError(error);
|
const message = maybeAxiosError(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user