question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slide reset issue

See original GitHub issue

Hi,

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

  1. Go to the repro
  2. Drag the carousel to go to slide 2.
  3. Click on the “swap” button
  4. 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:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
callumboothcommented, Feb 11, 2021

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.

0reactions
davidjerlekecommented, Feb 13, 2021

Hi Callum (@callumbooth),

I’m glad you got it sorted.

Cheers! David

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found