nitro-web 0.0.105 → 0.0.106

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.
@@ -58,6 +58,7 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
58
58
  const [state3, setState3] = useState(() => ({ ...queryObject(location.search) }))
59
59
  const [state, setState] = [state2 || state3, setState2 || setState3]
60
60
  const stateRef = useRef(state)
61
+ const locationRef = useRef(location)
61
62
  const count = useMemo(() => Object.keys(state).filter((k) => state[k] && filters?.some((f) => f.name === k)).length, [state, filters])
62
63
 
63
64
  const Elements = {
@@ -79,6 +80,10 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
79
80
  useEffect(() => {
80
81
  stateRef.current = state
81
82
  }, [state])
83
+
84
+ useEffect(() => {
85
+ locationRef.current = location
86
+ }, [location])
82
87
 
83
88
  useEffect(() => {
84
89
  // Only update the state if the filters haven't been input changed in the last 500ms
@@ -116,7 +121,7 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
116
121
  // Update the URL by replacing the current entry in the history stack
117
122
  function submit(includePagination?: boolean) {
118
123
  const queryStr = queryString(omit(stateRef.current, includePagination ? [] : ['page']))
119
- navigate(location.pathname + queryStr, { replace: true })
124
+ navigate(locationRef.current.pathname + queryStr, { replace: true })
120
125
  }
121
126
 
122
127
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",