Core Changes
- Add an optional
ReadonlySearchParamsProviderforuseReadonlySearchParams.- Previously,
useReadonlySearchParamsonly subscribed to the browser'spopstateevent, which keeps it up-to-date during history traversal (e.g., when the user navigates back or forward). Callingwindow.history.pushStateorwindow.history.replaceStatedoes not emitpopstateand therefore does not update the hook by default. - Now, if you wrap your app with
ReadonlySearchParamsProvider, the provider will patch both History API methods and allowuseReadonlySearchParamsto also update afterwindow.history.pushStateandwindow.history.replaceState. - Existing usage of
useReadonlySearchParamswithout the provider will continue to work as before.
- Previously,