Skip to content

Commit

Permalink
Awful hack to fix location issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Cubified committed May 16, 2024
1 parent eb9ded5 commit 764838c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
npm ci --legacy-peer-deps
npm run lint-check
npm run build
npm run experimental-generate
env:
NEXT_PUBLIC_BACKEND_URL: ''
NEXT_PUBLIC_FIREBASE_SETTINGS: '{"apiKey":"XXXXXXXXXXXX"}'
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"check": "next experimental-generate",
"start": "next start",
"lint": "next lint",
"check-git-hooks": "cd .. && node .secret-scan/secret-scan.js -- --check-git-hooks",
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/components/NewsletterSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ const NewsletterSidebar = ({
setIsEditing(false);
setErrors({});
setShowAlert(true);
if (window?.location) window.location.reload();
if (typeof window !== "undefined" && window?.location) {

Check failure on line 114 in frontend/src/components/NewsletterSidebar.tsx

View workflow job for this annotation

GitHub Actions / Frontend check

Prefer using an optional chain expression instead, as it's more concise and easier to read
const location = window.location as { reload: () => void };
location.reload();
}
}
};

Expand All @@ -133,7 +136,10 @@ const NewsletterSidebar = ({
alert(error);
});
setSidebarOpen(false);
if (window?.location) window.location.reload();
if (typeof window !== "undefined" && window?.location) {

Check failure on line 139 in frontend/src/components/NewsletterSidebar.tsx

View workflow job for this annotation

GitHub Actions / Frontend check

Prefer using an optional chain expression instead, as it's more concise and easier to read
const location = window.location as { reload: () => void };
location.reload();
}
}
};

Expand Down

0 comments on commit 764838c

Please sign in to comment.