From 325d8e1db4f7ac7288d956ff793033ba26277e1d Mon Sep 17 00:00:00 2001 From: Timo K Date: Thu, 18 Sep 2025 13:11:01 +0200 Subject: [PATCH] Add an option to skip the cache. Signed-off-by: Timo K --- src/UrlParams.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UrlParams.ts b/src/UrlParams.ts index 3f95e863..4bd5fced 100644 --- a/src/UrlParams.ts +++ b/src/UrlParams.ts @@ -331,12 +331,15 @@ let urlParamCache: { export const getUrlParams = ( search = window.location.search, hash = window.location.hash, + /** Skipping the cache might be needed in tests, to allow recomputing based on mocked platform changes. */ + skipCache = false, ): UrlParams => { // Only run the param configuration if we do not yet have it cached for this url. if ( urlParamCache.search === search && urlParamCache.hash === hash && - urlParamCache.params + urlParamCache.params && + !skipCache ) { return urlParamCache.params; }