Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Fix cookie consent reappearing on desktop builds (#5780)

James Brunton73213901d141
diff --git a/frontend/src/core/extensions/cookieConsentConfig.ts b/frontend/src/core/extensions/cookieConsentConfig.ts
new file mode 100644
index 0000000000..5d5b727739
--- /dev/null
+++ b/frontend/src/core/extensions/cookieConsentConfig.ts
@@ -0,0 +1,6 @@
+/**
+ * Optional overrides for cookie consent config.
+ */
+export function getCookieConsentOverrides(): Record<string, unknown> {
+ return {};
+}
diff --git a/frontend/src/core/hooks/useCookieConsent.ts b/frontend/src/core/hooks/useCookieConsent.ts
index a3a7977c1f..40c1a196dc 100644
--- a/frontend/src/core/hooks/useCookieConsent.ts
+++ b/frontend/src/core/hooks/useCookieConsent.ts
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import { BASE_PATH } from '@app/constants/app';
import { useAppConfig } from '@app/contexts/AppConfigContext';
import { TOUR_STATE_EVENT, type TourStatePayload } from '@app/constants/events';
+import { getCookieConsentOverrides } from '@app/extensions/cookieConsentConfig';
declare global {
interface Window {
@@ -112,9 +113,11 @@ export const useCookieConsent = ({
}
try {
+ const overrides = getCookieConsentOverrides();
window.CookieConsent.run({
autoShow: true,
hideFromBots: false,
+ ...overrides,
guiOptions: {
consentModal: {
layout: "bar",
diff --git a/frontend/src/desktop/extensions/cookieConsentConfig.ts b/frontend/src/desktop/extensions/cookieConsentConfig.ts
new file mode 100644
index 0000000000..8a40d7f66f
--- /dev/null
+++ b/frontend/src/desktop/extensions/cookieConsentConfig.ts
@@ -0,0 +1,7 @@
+export function getCookieConsentOverrides(): Record<string, unknown> {
+ return {
+ cookie: {
+ useLocalStorage: true, // Cookies don't reliably persist on desktop, but localStorage does
+ }
+ };
+}