patrickkunka / mixitup

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

Config object property "filter" doesn't complete before the "all" results are shown #581

Open voltmer1 opened 3 years ago

voltmer1 commented 3 years ago

I am using the config object to filter and change the page to a page number stored in sessionStorage when the user clicks on a link in the filtered results and then hits the back button to return to the same filtered results and page, but randomly when returning to the filtered results something is firing and causing mixitup to re-filter on the "all" value instead of the value stored in sessionStorage.

var mixer = mixitup(container, {

        pagination: {
            limit: 9 // impose a limit of 9 targets per page
        },
        load: {
            filter: localFilter,
            page:localPage
        },
        callbacks: {
            onMixEnd: () => {
                let currentFilter = $(selectFilter).val();
                sessionStorage.setItem('currentFilter', currentFilter);
                let currentPage = mixer.getState().activePagination.page;
                sessionStorage.setItem('currentPage', currentPage);
            }
        }

    });