diff --git a/src/components/UserProgress/UserProgressModal.tsx b/src/components/UserProgress/UserProgressModal.tsx index 1193077ef..8cce492a8 100644 --- a/src/components/UserProgress/UserProgressModal.tsx +++ b/src/components/UserProgress/UserProgressModal.tsx @@ -39,7 +39,11 @@ export function UserProgressModal(props: ProgressMapProps) { userId: propUserId, onClose: onModalClose, } = props; + const { s: userId = propUserId } = getUrlParams(); + if (!userId) { + return null; + } const resourceSvgEl = useRef(null); const popupBodyEl = useRef(null); @@ -97,7 +101,12 @@ export function UserProgressModal(props: ProgressMapProps) { deleteUrlParam('s'); setError(''); setShowModal(false); - onModalClose?.(); + + if (onModalClose) { + onModalClose(); + } else { + window.location.reload(); + } } useKeydown('Escape', () => { @@ -177,7 +186,7 @@ export function UserProgressModal(props: ProgressMapProps) { const userLearning = progress?.learning?.length || 0; const userSkipped = progress?.skipped?.length || 0; - if (!userId || currentUser?.id === userId) { + if (currentUser?.id === userId) { deleteUrlParam('s'); return null; }