this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

More accurate isActive

+12 -1
+12 -1
src/components/link.jsx
··· 19 19 let hash = (location.hash || '').replace(/^#/, '').trim(); 20 20 if (hash === '') hash = '/'; 21 21 const { to, ...restProps } = props; 22 - // TODO: maybe better pass hash into URL to deconstruct the pathname and search, then decodeURIComponent them 22 + 23 + // Handle encodeURIComponent of searchParams values 24 + if (!!hash && hash !== '/') { 25 + const parsedHash = new URL(hash, location.origin); // Fake base URL 26 + if (parsedHash.searchParams.size) { 27 + const searchParamsStr = Array.from(parsedHash.searchParams.entries()) 28 + .map(([key, value]) => `${key}=${encodeURIComponent(value)}`) 29 + .join('&'); 30 + hash = parsedHash.pathname + '?' + searchParamsStr; 31 + } 32 + } 33 + 23 34 const isActive = hash === to || decodeURIComponent(hash) === to; 24 35 return ( 25 36 <a