Commit 91795547 authored by Simon Knox's avatar Simon Knox

don't add empty query params to boards

parent ab56f4ef
......@@ -138,6 +138,7 @@ export const getUrlParamsArray = () =>
window.location.search
.slice(1)
.split('&')
.filter(param => param.length > 0)
.map(param => {
const split = param.split('=');
return [decodeURI(split[0]), split[1]].join('=');
......
......@@ -34,6 +34,7 @@ class BoardsStoreEE {
};
this.store.updateFiltersUrl = (replaceState = false) => {
if (!this.store.filter.path) return;
if (replaceState) {
window.history.replaceState(null, null, `?${this.store.filter.path}`);
} else {
......
---
title: don't add empty query params to boards
merge_request: 4441
author:
type: fixed
......@@ -30,8 +30,10 @@ describe('common_utils', () => {
});
describe('getUrlParamsArray', () => {
it('should return params array', () => {
expect(commonUtils.getUrlParamsArray() instanceof Array).toBe(true);
it('returns empty array for empty querystring', () => {
expect(
commonUtils.getUrlParamsArray()
).toEqual([]);
});
it('should remove the question mark from the search params', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment