Slide reset issue
See original GitHub issueHi,
I’m not sure if this is a bug or not, but there is a weird interaction when rendering the same carousel conditionally in two places.
It might be easier to show than to explain so I’ve created a repro here: https://codesandbox.io/s/embla-carousel-reinit-issue-fgw2d?file=/src/js/EmblaCarousel.js
Steps to reproduce
- Go to the repro
- Drag the carousel to go to slide 2.
- Click on the “swap” button
- See that the carousel has swapped back to slide 1.
Now if you remove the div on line 49 changing: <div>{renderCarousel()}</div>
to just {renderCarousel()}
then do the same steps as above, the carousel wont reset back to 0.
I know I can get around this by ensuring that the emblaRef is only ever used once but it popped up in a use case where it is cleaner to have a boolean higher and render the same carousel in two places.
Happy to give me info as required.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Most Common RV Slide Out Problems - Seeking The RV Life
RV slideout problems have plagued us all. Here are the most common, what to do about them, and how to prevent future issues....
Read more >Retiming a Schwintek Slide Out & Preventing Syncing Issues
The way to retime the Schwintek slide system is simple. You would go to the switch and depress the out button until the...
Read more >What to Do When Your RV Slides Won't Close
If you have a slide controller, try to reset it by disconnecting its power and/or data cables.
Read more >Troubleshooting Problems with Your RV Slide Outs
It is possible there may be something wrong with the electrical supply, such as a blown fuse, bad wiring, or a weak battery....
Read more >Trigger reset issue on new slide. - SIG Talk
Sounds like your FCU went thru the voluntary upgrade but the slide you bought wasn't upgraded. It needs that notch under the slide...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi David,
I don’t mind at all, always happy to look at different approaches.
I ended up getting it working by ensuring that the carousel doesn’t unmount (which was probably more efficient anyway) but the element.requestFullScreen looks really interesting so may see if it is worth refactoring at some point.
I’m going to close this since it never was a bug, I was just curious as to why it was happening which you have very helpfully answered and provided solutions to so thank you.
Hi Callum (@callumbooth),
I’m glad you got it sorted.
Cheers! David