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.

UseScrollTrigger does not trigger on-page-reload in gatsby production page

See original GitHub issue

Using gatsby witth gatsby-theme-material-ui the useScrollTrigger does not trigger on page reload when the page is build. In dev mode the behavior differs as one reloads on the top of the page not in the middle.

const trigger = useScrollTrigger({ disableHysteresis: true, threshold: 50 });

When I am in the middle of the page and reload, the trigger should fire but it does not.

@material-ui/core": “^4.9.0 gatsby-theme-material-ui”: "^1.0.8 “gatsby”: “^2.15.24”,

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ohlrcommented, Apr 23, 2020

@oliviertassinari regarding 1) I am not an expert in template design, so maybe open a new discussion in a separate issue? And do a poll (thumbs up / down) or something 😃

regarding 2) Fair point 😉 maybe its just me being to lazy reading existing docs carefully 😉

1reaction
oliviertassinaricommented, Apr 21, 2020

@ohlr Last year, around this period, we have started to prioritize work on interoperability with Gatsby and more broadly, for people building static websites with React. While our effort starts to play-off: https://npm-stat.com/charts.html?package=gatsby-plugin-theme-ui&package=gatsby-plugin-material-ui, I feel we could still do better. The main chunk we have plan for this story is to provide a new theme outside of the box (in addition to the default Material Design one we have currently). Is there anything else you would like to see coming? New components, e.g. Scrollspy, etc ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

UseScrollTrigger does not trigger on-page-reload in gatsby ...
Using gatsby witth gatsby-theme-material-ui the useScrollTrigger does not trigger on page reload when the page is build.
Read more >
How to turn on and off the scroll trigger in Material UI ...
After spending more time on this issue, here is the solution that I came up with that works: import { useScrollTrigger } from ......
Read more >
gatsby-plugin-material-ui
This is the plugin for Material-UI v5 (emotion). The plugin for v4 can be found here. Install. npm install gatsby-plugin-material ...
Read more >
The Pitfall of Material UI Theme with Gatsby | In the Middle
Problem with SSR-ing of MUI Theme. Not so fast, in early iteration of this website, we find the following bug in the production...
Read more >
ScrollTrigger issue with Gatsby - GSAP - GreenSock
The ScrollTrigger markers are misplaced when page loads, and might move (get more misplaced) on hard reloading page, depending on the current ...
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