Theme resetting to default for some of my users every 7 days

AI-generated summary

The theme is resetting to default for some users every 7 days. Jim_Starkweather initially thought it might be due to session expiration or client-side clearing. However, Falco identified the issue as related to Apple devices’ default behavior of removing cookies after 7 days. This causes the custom theme to reset when the cookie is removed.

To work around this, Falco suggested applying the theme to all devices, which saves the preference on the server. Other options include not visiting the site for 7 days, using a different browser on MacOS, or installing the Discourse PWA on iOS. Jim_Starkweather confirmed this explanation matches the reported behavior.

Any idea on why this would be happening? Is the theme setting a session? Maybe the session is expiring or being cleared by their client?

I only have a few people reporting this but it’s odd for sure.

They have the Dark theme selected and it’s fine for 7 days and then reverts to the Light theme (the site default).

Thanks,
Jim

For at least one of the people involved it’s happening on their mobile/phone.

Are they applying the theme change to all devices or just for a specific device?

From what they are telling me they are using Discourse from that device, the theme changes, they change it back and then 7 days later on that same device they see it revert back to the default theme. I can ask them about using it on other devices, but isn’t the theme choice set in their profile settings, etc?

Also at least one of the other affected users is seeing this happen on a PC client browser as well.

Are all those users on Apple devices?

By default, a custom theme applies only on the current device, unless you check this box manually:

When that happens the theme preference is saved locally in the device using a cookie.

On Apple devices native browsers, those cookies are removed after 7 days:

Workarounds are:

  • Apply theme to all devices, so we save that on the server

  • Never fail to visit the site for 7 days

  • on MacOS you can use another browser. Not an option on iOS

  • on iOS you can install the Discourse PWA with “Add to Homescreen” which bypasses the normal 7 days counter for a different one.

Ahhh… yes that sounds like what is happening then.

Thanks Falco. :slight_smile: