rsuite / responsive-nav

A tab component based on rsuite nav enhancements
https://rsuite.github.io/responsive-nav/
MIT License
3 stars 10 forks source link

Handle a possible null reference when changing pages in a SPA #41

Closed RJFelix closed 6 months ago

RJFelix commented 6 months ago

I found that, when changing pages in an SPA (React + Next.js in this case), sometimes handleResize is called after the container element is unmounted from the DOM (so containerRef.current is null), but before the responsive nav component is removed from the VDOM, causing an error during page change. Adding a null check fixes this.

simonguo commented 6 months ago

Hi @RJFelix. The code has been merged and a new version @rsuite/responsive-nav@5.0.2 has been released.