Fix back button not working
This commit is contained in:
1 parent
518cf4ce73
commit
f27aa58ac3
1 file changed
+11
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user