question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] isDarkTheme from useThemeContext always returns false

See original GitHub issue

🐛 Bug Report

In the default template for docusaurus, I am trying to use theme context to get isDarkTheme’s value. It is always set to false, even when I change to dark theme and then reload.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

(Write your steps here:)

  1. Use `const {isDarkTheme} = useThemeContext()
  2. add console.log for isDarkTheme
  3. turn on dark theme and reload

Expected behavior

Should provide true when dark theme is set

Actual Behavior

isDarkTheme is false even when dark them is on

Your Environment

  • Docusaurus version used:2.0.0-alpha.56
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node version: v12.17.0
  • Operating system and version (desktop or mobile): Ubuntu 16.04

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
slorbercommented, Jun 15, 2020

docs has been updated here by @Drewbi : https://github.com/facebook/docusaurus/pull/2934

still think it would be cool if the code did actually warn the user in case of using the hook without a provider (could throw with a link to the docs)

0reactions
JoelMarceycommented, Jun 10, 2020

@apsdehal Willing to submit a PR with better docs? 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theme configuration - Docusaurus
This configuration applies to all main themes.
Read more >
920 Message "instanceof will always return true" is false!
Collection are instances of java.util.Collection". This is incorrect since object could be null. The error message is misleading and could ...
Read more >
session_gc always returns FALSE for user defined handlers
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!...
Read more >
[错误] isdarktheme来自Usethemecontext总是返回false - 软件工程师 ...
isDarkTheme from useThemeContext always returns false Bug Report In the default template for docusaurus , I am trying to use theme context to...
Read more >
get_magic_quotes_gpc() returns false instead of 0 - externals.io
Happy to patch this once someone confirms this is a bug and not ... I think that when implementing it to always return...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found