Fix cookie consent reappearing on desktop builds (#5780)

# Description of Changes
Fix #5779. Cookie consent persistance doesn't work on desktop (on Mac at
least, not sure about Windows) because of permission differences with
Tauri. We are allowed to store things in local storage fine, so this
switches the cookie consent module to store in local storage for
desktop, and leaves it alone for web, where it already worked correctly.
This commit is contained in:
James Brunton
2026-02-23 20:53:31 +00:00
committed by GitHub
parent 91b4a3484c
commit 73213901d1
3 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
/**
* Optional overrides for cookie consent config.
*/
export function getCookieConsentOverrides(): Record<string, unknown> {
return {};
}

View File

@@ -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",

View File

@@ -0,0 +1,7 @@
export function getCookieConsentOverrides(): Record<string, unknown> {
return {
cookie: {
useLocalStorage: true, // Cookies don't reliably persist on desktop, but localStorage does
}
};
}