patrickkunka / mixitup

A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more

Home Page:https://www.kunkalabs.com/mixitup/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

voltmer1 opened this issue · comments

commented

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);
            }
        }
        
    });