Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh theme cookie expiration date #2193

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MinetaS
Copy link
Contributor

@MinetaS MinetaS commented Feb 3, 2025

No description provided.

@ppigazzini
Copy link
Collaborator

ppigazzini commented Feb 3, 2025

https://dfts-0.pigazzini.it/tests

DEV updated.
Randomly clicking to the sun/moon icons and to the home page link, the sun/moon icons seem to stop working.
Drafted.

@ppigazzini ppigazzini marked this pull request as draft February 3, 2025 20:58
@MinetaS
Copy link
Contributor Author

MinetaS commented Feb 3, 2025

It seems that the first line adds dark theme CSS link first and then the duplicate one is added afterwards.

@MinetaS
Copy link
Contributor Author

MinetaS commented Feb 3, 2025

I make the script set theme and removed according lines in the template.
Should be good now, but have no idea whether this is a good practice or not.

if (!getCookie("theme")) {
setTheme(mediaTheme());
}
setTheme(getCookie("theme") ?? mediaTheme());
Copy link
Contributor

@peregrineshahin peregrineshahin Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes false in case the left side is false, which the function doesn't handle obviously because it only checks for dark and consider anything else as light, you need to make a separate refresh function to call in the else part of the original code if statement, looks so wrong and bugged.

@ppigazzini
Copy link
Collaborator

I confirm that it's bugged.
Select the dark theme, open a slow page, the page is loaded with the light theme, when the load is complete the page switches to the dark theme.
https://dfts-0.pigazzini.it/contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants