diff --git a/src/features/editor/components/header/sharing-menu.tsx b/src/features/editor/components/header/sharing-menu.tsx index 5f11f63..8fd026b 100644 --- a/src/features/editor/components/header/sharing-menu.tsx +++ b/src/features/editor/components/header/sharing-menu.tsx @@ -40,14 +40,24 @@ export const SharingMenu = () => { } }; - useEffect(() => { + const handleTooltipTriggerClick = () => { + prepareSharedUrl(); + }; + + const prepareSharedUrl = () => { const url = new URL(location.href); + const searchParams = new URLSearchParams(location.hash.slice(1)); if (!isWithCode) { searchParams.delete('code'); } url.hash = searchParams.toString(); + setSharedUrl(url.href); + }; + + useEffect(() => { + prepareSharedUrl(); }, [isTooltipOpen, isWithCode]); return ( @@ -56,7 +66,11 @@ export const SharingMenu = () => { -