patrickkunka / mixitup

A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more
https://www.kunkalabs.com/mixitup/
4.52k stars 735 forks source link

Cannot read property 'scrollTop' of null #537

Closed brooth closed 4 years ago

brooth commented 4 years ago

MixItUp fails on the append() method if disable animation.

Inititialization:

const mixer = mixitup('#mix-collection', {
      animation: {
          enable: false
      },
    });

Stacktrace:

mixitup.js:6330 Uncaught TypeError: Cannot read property 'scrollTop' of null
    at mixitup.Mixer.goMix (mixitup.js:6330)
    at mixitup.Mixer.multimix (mixitup.js:8458)
    at mixitup.Mixer.insert (mixitup.js:8730)
    at mixitup.Mixer.append (mixitup.js:8912)

Fails here:

           // If we should animate and the platform supports transitions, go for it
            if (window.pageYOffset !== operation.docState.scrollTop) {
                window.scrollTo(operation.docState.scrollLeft, operation.docState.scrollTop);
            }
patrickkunka commented 4 years ago

Hi there - thanks for reporting. I'm unable to reproduce this issue. Can you include your append API call code too - or a jsfiddle reproduction?

Thanks