You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function valueForParam(param: string | string[]): string {
55
-
if (Array.isArray(param)) {
56
-
return param[0] || '';
57
-
}
58
-
return param || '';
59
-
}
46
+
const urlSearchParams = new URLSearchParams(urlSearch);
60
47
return {
61
-
crumbEvent: valueForParam(crumbEvent),
62
-
crumbId: valueForParam(crumbId),
48
+
// Use `''` for backwards compatibility with deprecated code.
49
+
crumbEvent: urlSearchParams.get(eventKey) ?? '',
50
+
crumbId: urlSearchParams.get(idKey) ?? '',
63
51
};
64
52
}, [urlSearch, idKey, eventKey]);
65
53
66
54
useEffect(() => {
55
+
/**
56
+
* Keep track of the old query string keys so we can remove them.
57
+
*/
67
58
const oldIdKey = idKey;
68
59
const oldEventKey = eventKey;
60
+
/**
61
+
* When `idKey` or `eventKey` changes (such as when the `resolverComponentInstanceID` has changed) or when the component unmounts, remove any state from the query string.
0 commit comments