Filters are not getting applied on reload

I am using historyRouter as per the documentation for seo-friendly-urls. The filters and url creation work fine, but once the user reload the url post applying filters or sort, the url gets cleared of the parameters and the page is loaded without filter or sort application. The Router variable is as follows: `
router: historyRouter({

    createURL({ qsModule, routeState, location }) {
        console.log("createURL",routeState)
        
    let url = window.location.href;
    var pathname = new URL(url).pathname;
    if (pathname !== "/component-detail") {
        const urlParts = location.href.match(/^(.*?)\/algolia/);
        const baseUrl = `${urlParts ? urlParts[1] : ""}/`;
        let queryParameters = {};
        let productLineId = new URL(url).searchParams.get("componentId")
        let catId = new URL(url).searchParams.get("catId")
        let catName = new URL(url).searchParams.get("scatName")
        let generatedUrl = ''
        if (productLineId) {
            queryParameters.productLineId = encodeURIComponent(productLineId);
        }
        if (catId) {
            queryParameters.catId = encodeURIComponent(catId);
        }
        if (catName) {
            let catNameRemovedWhiteSpace= safeDecodeURIComponent(catName)
            queryParameters.catName = encodeURIComponent(catNameRemovedWhiteSpace);
        }
        if (routeState.stext) {
            queryParameters.stext = routeState.stext
        }
        if (routeState.productLineId) {
            queryParameters.productLineId = encodeURIComponent(routeState.productLineId);
        }
        if (routeState.sortBy) {
            queryParameters.sortBy = encodeURIComponent(routeState.sortBy);
        }
        if (routeState.pageNum) {
            queryParameters.pageNum = encodeURIComponent(routeState.pageNum);
        }
        const routeKeys = Object.keys(routeState);
        const check = ["stext", "sortBy", "pageNum"];
        let filterKeys = routeKeys.map(element => {
        if (!check.includes(element)) {
            return element;
        }
        });
        
        filterKeys = filterKeys.filter(function(element) {
            return element !== undefined;
        });

        filterKeys.forEach(element => {
            queryParameters[element] = routeState[element].map(
                encodeURIComponent
            );
        });
        const queryString = qsModule.stringify(queryParameters, {
            addQueryPrefix: true,
            arrayFormat: "repeat"
        });
        if (pathname == "/component") {
            generatedUrl= `${baseUrl}component${queryString}`;
        }
        if (pathname == "/algolia") {
            generatedUrl= `${baseUrl}algolia${queryString}`;
        }
        console.log("generatedUrl",generatedUrl)
        return generatedUrl
    }
    },

    parseURL({ qsModule, location }) {
        console.log("parseURL",qsModule)
        const pathnameMatches = location.pathname.match(/algolia\/(.*?)\/?$/);
        let params = qsModule.parse(location.search.slice(1));
        const returnObj = {};
        if (Object.keys(params).length > 0) {
            for (var key in params) {
                    if (key === "sortBy") {
                        returnObj["sortBy"] = params[key];
                    } else if (key === "page") {
                        returnObj["pageNum"] = params[key];
                    } else {
                    let value = Array.isArray(params[key])
                        ? params[key]
                        : [params[key]].filter(Boolean);
                        returnObj[key] = value.map(decodeURIComponent);
                    }
            }
        }
        console.log("parese Url returnObj",returnObj)
        return returnObj;		
    }
    
stateMapping: {
    stateToRoute(uiState) {
        console.log("stateToRoute uiState",uiState)
        const indexUiState = uiState[algoliaIndex];
        const stateObj = {
            stext: indexUiState.query,
            sortBy: indexUiState.sortBy,
            pageNum: indexUiState.page
        };
        let rlist = (localStorage.getItem("refinementList")?localStorage.getItem("refinementList"):"not found")
        const refinementArray = (indexUiState.refinementList)?(indexUiState.refinementList):"";
        if (refinementArray) {
            for (const [k, v] of Object.entries(refinementArray)) {
            stateObj[k] =
                indexUiState.refinementList && indexUiState.refinementList[k];
            }
        }
        console.log("stateToRoute stateObj",stateObj)
        return stateObj;
    },
    routeToState(routeState) {
        console.log("routeToState routeState ",routeState)
        const routeKeys = Object.keys(routeState);
        const check = ["stext", "sortBy", "pageNum"];
        let filterKeys = routeKeys.map(element => {
            if (!check.includes(element)) {
            return element;
            }
        });
        let refinementList = {};
        filterKeys = filterKeys.filter(function(element) {
            return element !== undefined;
        });
        filterKeys.forEach(element => {
            refinementList[element] = routeState[element];
        });

        console.log("routeToState return obj", {
            query: Array.isArray(routeState.stext)?routeState.stext[0]:routeState.stext,
            sortBy: routeState.sortBy,
            refinementList: refinementList,
            page: routeState.pageNum
            })
        return {
            [algoliaIndex]: {
            query: Array.isArray(routeState.stext)?routeState.stext[0]:routeState.stext,
            sortBy: routeState.sortBy,
            refinementList: refinementList,
            page: routeState.pageNum
            }
        };
    },
    
}
}),`

Can anyone please help with this?