Fix back button not working

pull/3532/merge
Kamran Ahmed 1 year ago
parent 518cf4ce73
commit f27aa58ac3
  1. 13
      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<HTMLDivElement>(null);
const popupBodyEl = useRef<HTMLDivElement>(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;
}

Loading…
Cancel
Save