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 = () => ...@@ -138,6 +138,7 @@ export const getUrlParamsArray = () =>
window.location.search window.location.search
.slice(1) .slice(1)
.split('&') .split('&')
.filter(param => param.length > 0)
.map(param => { .map(param => {
const split = param.split('='); const split = param.split('=');
return [decodeURI(split[0]), split[1]].join('='); return [decodeURI(split[0]), split[1]].join('=');
......
...@@ -34,6 +34,7 @@ class BoardsStoreEE { ...@@ -34,6 +34,7 @@ class BoardsStoreEE {
}; };
this.store.updateFiltersUrl = (replaceState = false) => { this.store.updateFiltersUrl = (replaceState = false) => {
if (!this.store.filter.path) return;
if (replaceState) { if (replaceState) {
window.history.replaceState(null, null, `?${this.store.filter.path}`); window.history.replaceState(null, null, `?${this.store.filter.path}`);
} else { } else {
......
---
title: don't add empty query params to boards
merge_request: 4441
author:
type: fixed
...@@ -30,8 +30,10 @@ describe('common_utils', () => { ...@@ -30,8 +30,10 @@ describe('common_utils', () => {
}); });
describe('getUrlParamsArray', () => { describe('getUrlParamsArray', () => {
it('should return params array', () => { it('returns empty array for empty querystring', () => {
expect(commonUtils.getUrlParamsArray() instanceof Array).toBe(true); expect(
commonUtils.getUrlParamsArray()
).toEqual([]);
}); });
it('should remove the question mark from the search params', () => { 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