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

[Performance Issue] Used in multithreading #12607

Open
3 tasks done
hezhisheng1930 opened this issue Apr 16, 2024 · 2 comments
Open
3 tasks done

[Performance Issue] Used in multithreading #12607

hezhisheng1930 opened this issue Apr 16, 2024 · 2 comments

Comments

@hezhisheng1930
Copy link

Prerequisites

  • I searched for any existing report about this performance issue to avoid opening a duplicate.
  • I have restarted the web browser to check if that resolved this performance issue.
  • I can reproduce this performance issue in a new, unmodified web browser profile with Dark Reader installed as the only extension.

Performance Issue Description

After turning on dark mode, the main thread will be blocked and the interface will freeze. Can the function of turning on night mode be implemented in Worker?

Website Address

https://www.hezhisheng.fun

Steps To Reproduce

When dark mode is turned on, the interface will freeze.

Performance Profile

When dark mode is turned on, the interface will freeze.

Screenshots

No response

Operating System

win 10

Web Browser name and version

chrome

Dark Reader version

4.9.81

Does this happen when Dark Reader is disabled?

No

Does this happen in other web browsers?

Yes

Additional Context

No response

@alexanderby
Copy link
Member

Please try version 4.9.83.

@vik-buchinski
Copy link

vik-buchinski commented Apr 26, 2024

Please try version 4.9.83.

This version doesn't work as well.
For some reason, it takes about 10s to enable the dark mode in the js, and after it is enabled, some interactable elements just stop working or it takes about 10-15s for it's handlers to be called.

Here is the code how I enable it in react application:

import { enable as enableDarkMode, disable as disableDarkMode, isEnabled as isDarkReaderEnabled } from 'darkreader'; import { useState } from 'react'; export const useSomeHook = () => { const [isDarkModeEnabled, setIsDarkModeEnabled] = useState(isDarkReaderEnabled()); const handleModeBtnClick = () => { isDarkModeEnabled ? disableDarkMode() : enableDarkMode({ brightness: 100, contrast: 90, sepia: 10, }); setIsDarkModeEnabled(!isDarkModeEnabled); }; return { handleModeBtnClick }; };

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

No branches or pull requests

3 participants