shbatm / MMM-Carousel

Displays a single magic mirror module at a time, rotating through the list of configured modules in a carousel-like fashion.
MIT License
40 stars 13 forks source link

[Bug] Transition timeout not working #65

Closed btastic closed 1 year ago

btastic commented 1 year ago

Describe the bug When using the transitionTimeout config, nothing is happening.

To Reproduce Steps to reproduce the behavior:

  1. Mode: 'slides'
  2. Make at least 2 slides
  3. Move to the 2nd slide
  4. Wait for the transition timeout to happen
  5. Not working

Expected behavior Move to the configured homeSlide

Configuration

{
    module: "MMM-Carousel",
    position: "bottom_bar", // Required only for navigation controls
    config: {
        transitionInterval: 0,
        ignoreModules: [
            "weather",
            "clock",
            "alert",
            "updatenotification",
            "newsfeed",
            "MMM-GoogleCalendar",
            "calendar",
            "MMM-GPIO-Notifications",
            "MMM-Screen-Powersave-Notification"
        ],
        mode: "slides",
        showPageIndicators: true,
        showPageControls: false,
        slides: {
            main: ["MMM-Globe"],
            "Slide 2": ["MMM-CalendarExt3", "MMM-CalendarExt3Agenda", "MMM-Formula1", "MMM-moonraker"],
            "Slide 3": [
                "MMM-Russianwarship", "MMM-germanwordclock",
            ],
        },
        transitionTimeout: 10000,
        homeSlide: 0,
    }
}

Logs

properties of undefined (reading 'homeSlide')
    at Class.transitionTimeoutCallback (MMM-Carousel.js:474:28)
    at MMM-Carousel.js:466:14
transitionTimeoutCallback @ MMM-Carousel.js:474
(anonymous) @ MMM-Carousel.js:466
setTimeout (async)
restartTimer @ MMM-Carousel.js:465
manualTransitionCallback @ MMM-Carousel.js:489
(anonymous) @ MMM-Carousel.js:507

I suspect that the callback is not called correctly, because it seems to lose the this context. After changing it, so the context is being captured, other problems start to occur.

Calling this.moduleTransition from inside the callback, seems to lose the initial binding of the modules context. This will lead to this.length being undefined, among other undefined this. fields.

I am not sure how all of this is intertwined, since I am asking for help on how to fix this..?

btastic commented 1 year ago

Accidental duplicate of #64