gerhardsletten / react-reader

An ePub-reader for React, powered by Epub.js
https://react-reader.metabits.no
Apache License 2.0
721 stars 132 forks source link

Update EpubView on URL change #159

Closed eliot-akira closed 1 year ago

eliot-akira commented 1 year ago

I was having an issue where EpubView wasn't refreshing when a new URL was passed, and I think I found a bug in shouldComponentUpdate.

https://github.com/gerhardsletten/react-reader/blob/ab051bc1d191725b2836015750290d53828595dd/src/modules/EpubView/EpubView.js#L54-L60

It's comparing the same location prop twice, but I believe it was meant to compare the URL.

nextProps.url !== this.props.url

With this change, the component re-renders as expected when a new URL is passed.

vercel[bot] commented 1 year ago

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

Name Status Preview Comments Updated (UTC)
react-reader ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 11, 2023 8:02pm
gerhardsletten commented 1 year ago

@eliot-akira Thanks, published to react-reader@1.2.2 now!