akiran / akiran/react-slick

asNavFor does not work if slider renders conditionally

Offen
#1,775 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
11.9k
Forks
2.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.