TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 70 forks source link

Fix updating transition renderer component #208

Closed VitaliyR closed 4 years ago

VitaliyR commented 4 years ago

Hello!

In my gatsby app, data is being updated frequently, but HMR wasn't working fine. I've started to search for the reason why it is broken and found that when the data is updated, it's being stuck in TransitionRenderer component.

wrap-page is wrapping each gatsby page with its own layout, and render children inside it. Children here are the gatsby page itself. TransitionRenderer has implemented shouldComponentUpdate with checks which are required, but it's not checking also for children - has they been updated or not. So the page is never gets updated until it's refreshed.

I've added to shouldComponentUpdate this check, and it fixes HMR back to normal.

TylerBarnes commented 4 years ago

Just merged this in! Thank you so much and sorry for the delay on this. It's so hard to find time for this package lately unfortunately :(

TylerBarnes commented 4 years ago

Published in gatsby-plugin-transition-link@1.18.1