Skip to content

[Bug]: React 19 slidesinview event not triggered initially #1298

@ricardo-a-alves-alb

Description

@ricardo-a-alves-alb

Which variants of Embla Carousel are you using?

  • embla-carousel (Core)
  • embla-carousel-react
  • embla-carousel-vue
  • embla-carousel-svelte
  • embla-carousel-autoplay
  • embla-carousel-auto-scroll
  • embla-carousel-solid
  • embla-carousel-auto-height
  • embla-carousel-class-names
  • embla-carousel-fade
  • embla-carousel-docs (Documentation)
  • embla-carousel-docs (Generator)

Steps to reproduce

When running the embla-carousel with React 18, the event slidesinview gets triggered initially and we can use it properly with the lazyload approach.

However, when running the embla-carousel with React 19, the event doesn't get triggered initially (or sometimes it does, rarely).

I've attached two CodeSandbox URLs, one running React 18 and another React 19.

Expected Behavior

Expected to get the event slidesinview triggered initially on both React versions.

Additional Context

React 18: https://codesandbox.io/p/devbox/embla-carousel-default-react-forked-jd9vd3

What browsers are you seeing the problem on?

Chrome

Version

v9.0.0-rc01

CodeSandbox

React 19: https://codesandbox.io/p/devbox/embla-carousel-default-react-forked-4wvzy3

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
  • I agree to follow this project's Contributing Guidelines for bug reports

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions