italia / design-react-kit

Il toolkit React conforme alle linee guida di design per i siti internet e i servizi digitali della PA.
https://italia.github.io/design-react-kit/
BSD 3-Clause "New" or "Revised" License
152 stars 80 forks source link

fix: refresh callback declaration fix in useNavScroll #1061

Closed Nick87 closed 2 months ago

Nick87 commented 2 months ago

Fixes #1057

PR Checklist

Short description of what this resolves:

This PR resolves an infinite render loop when using useNavScroll.

Changes proposed in this Pull Request:

I propose to change the current refresh callback declaration which causes an infinite render loop. Changes have been successfully tested by copying the first example in https://italia.github.io/design-react-kit/?path=/docs/documentazione-menu-di-navigazione-navscroll--documentazione in the design-react-kit-playground project: navigation items are correctly updated and no infinite render loop occurs.

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
design-react-kit ✅ Ready (Inspect) Visit Preview Apr 27, 2024 10:26am