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

Gatsby Head API doesn’t react on context change #38488

Open
2 tasks done
juliavorcakova opened this issue Aug 28, 2023 · 0 comments
Open
2 tasks done

Gatsby Head API doesn’t react on context change #38488

juliavorcakova opened this issue Aug 28, 2023 · 0 comments
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@juliavorcakova
Copy link

Preliminary Checks

Description

I need to share a state between body and head. I’m trying to achieve it with context and Gatsby Head API, but Gatsby Head doesn’t seems to react on context changes. It reads the initial state correctly, but after the context is updated it doesn’t rerender.

Reproduction Link

https://codesandbox.io/p/sandbox/sad-hofstadter-vl7jl8?file=%2Fsrc%2Fpages%2Findex.js%3A22%2C38

Steps to Reproduce

  1. start the app https://vl7jl8-8000.csb.app/
  2. open browser console
  3. click on 'update context' button
  4. observe that after clicking the button, there are no logs from Gatsby Head (head context: {contextValue}) nor changes in "context-test" meta tag

Expected Result

Head rerenders when context value changes.

Actual Result

Head doesn’t react on context value change.

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
  Binaries:
    Node: 18.17.0 - C:\Program Files\nodejs\node.EXE
    npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.10.11
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.200)
  npmPackages:
    gatsby: ^5.12.1 => 5.12.1
    gatsby-plugin-manifest: 4.24.0 => 4.24.0
    gatsby-plugin-react-helmet: 5.25.0 => 5.25.0
    gatsby-plugin-react-helmet-canonical-urls: 1.4.0 => 1.4.0

Config Flags

No response

@juliavorcakova juliavorcakova added the type: bug An issue or pull request relating to a bug in Gatsby label Aug 28, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

1 participant