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

Đang mở
#1,512 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, tailwindcss, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Tái hiện vấn đề trong một dự án Gatsby sử dụng các component Flowbite và Flowbite-react, sau đó tìm cookie flowbite-theme-mode và cách xử lý cookie này trong localStorage. Xác nhận hành vi khi không cấu hình chế độ giao diện; hoàn thành nghĩa là chế độ sáng mặc định hoạt động mà không buộc cookie hoặc giá trị lưu trữ đó phải được đặt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • [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.

Ngôn ngữ chính
TypeScript
Star
2.1k
Fork
502
Merge trung bình
19 giờ 16 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của themesberg/flowbite-react

Tất cả issue của themesberg/flowbite-react

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.