File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -248,17 +248,15 @@ function applyFilters(filtersParams) {
248248
249249// Apply current filters to URL
250250function applyFiltersToURL ( filterParams ) {
251- let filters = ''
252- for ( let key in filterParams ) {
253- if ( filterParams [ key ] . length ) {
254- filters = filters + `${ key } =${ filterParams [ key ] . join ( ',' ) } &`
255- }
256- }
257- // Remove extra &
258- if ( filters ) {
259- filters = filters . slice ( 0 , filters . length - 1 )
251+ const url = new URL ( window . location )
252+ const params = new URLSearchParams ( )
253+
254+ for ( const [ key , values ] of Object . entries ( filterParams ) ) {
255+ values . forEach ( value => params . append ( key , value ) )
260256 }
261- window . history . replaceState ( null , '' , `?${ filters } ` )
257+
258+ url . search = params . toString ( )
259+ window . history . replaceState ( null , '' , url )
262260}
263261
264262// Apply URL to filters
You can’t perform that action at this time.
0 commit comments