From 860e46d3ecac63dd609127dfa021b30d07caf2eb Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 7 Apr 2022 21:18:00 -0300 Subject: [PATCH] Fix share dialog cache issue --- .../maps-page/action-dispatcher/share-dialog/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx index 246bcf70..67e797cf 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx @@ -34,6 +34,7 @@ type ShareModel = { const defaultModel: ShareModel = { emails: '', role: 'editor', message: '' }; const ShareDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => { const intl = useIntl(); + const queryClient = useQueryClient(); const client: Client = useSelector(activeInstance); const queryClient = useQueryClient(); const classes = useStyles(); @@ -83,11 +84,10 @@ const ShareDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement ); const handleOnClose = (): void => { + // Invalidate cache ... + queryClient.invalidateQueries(`perm-${mapId}`); onClose(); - // Invalidate cache ... - const queryClient = useQueryClient(); - queryClient.invalidateQueries(`perm-${mapId}`); }; const handleOnChange = (event: React.ChangeEvent): void => {