akiran / akiran/react-slick

asNavFor does not work if slider renders conditionally

Aperta
#1,775 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
11.9k
Fork
2.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

When you have some async routes or simply conditional rendering of the Gallery (slider) `asNavFor` attribute does not sync both sliders unless you trigger a redundant force update of the component.

Codesandbox that reproduces the issue: https://codesandbox.io/s/react-slick-playground-0q390?file=/index.js

Scenario:
* First click the `show` button, both sliders appears on the page but when you navigate between them they don't appear to be synced.
* Click `rerender` button
* Try navigating between sliders once again. They should be working in sync.

Expected behavior:
Both sliders should be synced right after the initial render.
**OR**
You should mention in the documentation that you need to force the render of another component when you're using `asNavFor` property on your slider.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.