|
|
@@ -6,10 +6,10 @@ function getURLQueryParamValue(key: string): string | null {
|
|
|
// window.location.href is page URL;
|
|
|
const queryStr: URLSearchParams = new URL(window.location.href).searchParams;
|
|
|
if (queryStr === null) {
|
|
|
- return '';
|
|
|
+ return null;
|
|
|
}
|
|
|
if (queryStr.get(key) === null) {
|
|
|
- return '';
|
|
|
+ return null;
|
|
|
}
|
|
|
return queryStr.get(key);
|
|
|
}
|
|
|
@@ -17,7 +17,11 @@ function getURLQueryParamValue(key: string): string | null {
|
|
|
const ShowPageAccessoriesModal = (): JSX.Element => {
|
|
|
const { open: openPageAccessories } = usePageAccessoriesModal();
|
|
|
useEffect(() => {
|
|
|
- if (getURLQueryParamValue('compare')!.split('...').length > 1) {
|
|
|
+ const pageIdParams = getURLQueryParamValue('compare');
|
|
|
+ if (pageIdParams === null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pageIdParams.split('...').length > 1) {
|
|
|
openPageAccessories(PageAccessoriesModalContents.PageHistory);
|
|
|
}
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|