willba-component-library 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "A stroybook 6 with TypeScript demo",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -107,27 +107,29 @@ export default function useFilterBar({
107
107
  const currentSearchParams = new URLSearchParams(window.location.search)
108
108
  const updatedParams = new URLSearchParams()
109
109
 
110
+ // Copy existing parameters to updatedParams
110
111
  for (const [key, value] of currentSearchParams.entries()) {
111
112
  updatedParams.append(key, value)
112
113
  }
113
114
 
115
+ // Update parameters based on newParams
114
116
  for (const [key, value] of Object.entries(newParams)) {
115
117
  if (value) {
118
+ console.log(value)
116
119
  updatedParams.set(key, value.toString())
117
120
  } else {
121
+ // Remove parameter if value is falsy
118
122
  updatedParams.delete(key)
119
123
  }
120
124
  }
121
125
 
122
- console.log(currentSearchParams.toString(), updatedParams.toString())
126
+ console.log(updatedParams.toString())
123
127
 
124
- // Get the current URL without the query string
125
128
  const baseUrl = window.location.origin + window.location.pathname
126
129
 
127
130
  // Construct the updated URL with the modified query parameters
128
131
  const updatedUrl = `${baseUrl}?${updatedParams.toString()}`
129
132
 
130
- // Replace the current URL with the updated URL in the browser's history
131
133
  return (window.location.href = updatedUrl)
132
134
  } else {
133
135
  const querySearchParams = new URLSearchParams()