themesberg / themesberg/flowbite-react

No force setting a cookie in localStorage when theme mode stays at default

Open
#1,512 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.1k
Forks
506
PR merge metrics
No merged PRs in 30d

Description

  • [x ] I have searched the Issues to see if this bug has already been reported
  • [ x] I have tested the latest version

Steps to reproduce

  1. Create a gatsbyjs project
  2. Install Flowbite and Flowbite-react
  3. Implement component without setting a theme
  4. Develop with 'Gatsby develop'
  5. Take a look into local storage in browser

Current behavior

The 'flowbite-theme-mode' cookie is ALWAYS being set even if no theme mode being used.

Expected behavior

Having control over what cookie being set or at least fix a default value somewhere else preventing a cookie being set, when no theme mode is being used. I expect a default value written in the codes core not in a cookie.

Context

I tried to remove the cookie by code. Since I am using multiple templates, I tried removing it with onClientEntry and onInitialClientRender which will only succeed once. As soon as the site being reloaded, the cookie is back.

There seems to be no option to control this cookie. Searching the code also results in nothing. I could not find anything to control this cookie. I do use a custom theme but with no theme mode. It should be light by default, but it should definitely not being read from the local storage but being set internally. It does not make much sense to force write a default value into a cookie when this value will never ever change.

No dark mode, just default light mode.

If you dont respect GDPR because it is annoying we can team up: I dont like the rules either!
But reading default values from a cookie which is written by default does not make a lot of sense. Store the default values in the core, not in a cookie.

NOTE: I know some people are allergic on this specific issue. You can detach this from the GDPR topic and focus on NOT setting a cookie when there is no theme mode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a Gatsby project using the Flowbite and Flowbite-react components, then search for the flowbite-theme-mode cookie and its localStorage handling. Confirm the behavior with no theme mode configured; done means the default light mode works without forcing that cookie or storage value.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, tailwindcss, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.