swiper icon indicating copy to clipboard operation
swiper copied to clipboard

Thumbs Module not working on Strict Mode

Open JavoByte opened this issue 1 year ago • 3 comments

Check that this is really a bug

  • [X] I confirm

Reproduction link

https://codesandbox.io/p/devbox/swiper-react-thumbs-gallery-forked-6j6tf2?file=%2Fsrc%2Fmain.jsx%3A7%2C37

Bug description

Running the Thumbs example using StrictMode and hydrateRoot breaks with Cannot convert undefined or null to object. It seems this is due to Swiper instance being destroyed.

Expected Behavior

Thumbs works in strict mode

Actual Behavior

No response

Swiper version

11.1.3

Platform/Target and Browser Versions

macOS Chrome

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the docs.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • [X] Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • [X] I'm willing to open a PR

JavoByte avatar May 30 '24 01:05 JavoByte

same issue

chenershisi avatar Aug 16 '24 07:08 chenershisi

Hi guys, any workaround for this?

rchowdhe avatar Oct 17 '24 05:10 rchowdhe

the workaround is thumbs={{ swiper: thumbsSwiper }} replace to thumbs={{ swiper: thumbsSwiper && !thumbsSwiper.destroyed ? thumbsSwiper : null }}

rchowdhe avatar Oct 17 '24 06:10 rchowdhe