Fix handler resolution issue.

This commit is contained in:
Paulo Gustavo Veiga 2022-04-07 14:32:39 -03:00
parent 4a04b60693
commit 89ce9f2a60

View File

@ -20,7 +20,7 @@ import Paper from '@mui/material/Paper';
const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => { const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => {
const intl = useIntl(); const intl = useIntl();
const queryClient = useQueryClient();
const client: Client = useSelector(activeInstance); const client: Client = useSelector(activeInstance);
const { data } = useQuery<unknown, ErrorInfo, ChangeHistory[]>(`history-${mapId}`, () => { const { data } = useQuery<unknown, ErrorInfo, ChangeHistory[]>(`history-${mapId}`, () => {
return client.fetchHistory(mapId); return client.fetchHistory(mapId);
@ -28,11 +28,8 @@ const HistoryDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
const changeHistory: ChangeHistory[] = data ? data : []; const changeHistory: ChangeHistory[] = data ? data : [];
const handleOnClose = (): void => { const handleOnClose = (): void => {
onClose();
// Invalidate cache ...
const queryClient = useQueryClient();
queryClient.invalidateQueries(`history-${mapId}`); queryClient.invalidateQueries(`history-${mapId}`);
onClose();
}; };
const handleOnClick = (event, vid: number): void => { const handleOnClick = (event, vid: number): void => {