From 05abff83a754132559b119e712d1d303632332a5 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 27 Jan 2023 17:18:23 +0530 Subject: [PATCH] fix collection not updated after creating public URL --- .../Collections/CollectionShare/publicShare/control.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Collections/CollectionShare/publicShare/control.tsx b/src/components/Collections/CollectionShare/publicShare/control.tsx index 34e51921c..5b45cfa3f 100644 --- a/src/components/Collections/CollectionShare/publicShare/control.tsx +++ b/src/components/Collections/CollectionShare/publicShare/control.tsx @@ -1,5 +1,6 @@ import { Box, Typography } from '@mui/material'; import { FlexWrapper } from 'components/Container'; +import { GalleryContext } from 'pages/gallery'; import { AppContext } from 'pages/_app'; import React, { useContext, useState } from 'react'; import { @@ -22,7 +23,7 @@ export default function PublicShareControl({ setPublicShareProp, }: Iprops) { const appContext = useContext(AppContext); - + const galleryContext = useContext(GalleryContext); const [sharableLinkError, setSharableLinkError] = useState(null); const createSharableURLHelper = async () => { @@ -30,6 +31,7 @@ export default function PublicShareControl({ appContext.startLoading(); const publicURL = await createShareableURL(collection); setPublicShareProp(publicURL); + await galleryContext.syncWithRemote(false, true); } catch (e) { const errorMessage = handleSharingErrors(e); setSharableLinkError(errorMessage); @@ -43,6 +45,7 @@ export default function PublicShareControl({ appContext.startLoading(); await deleteShareableURL(collection); setPublicShareProp(null); + await galleryContext.syncWithRemote(false, true); } catch (e) { const errorMessage = handleSharingErrors(e); setSharableLinkError(errorMessage);