mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-27 03:35:50 +03:00
Don't need useLocation when in compose pop-out
This commit is contained in:
parent
37fc65b47a
commit
e0d50168fd
1 changed files with 5 additions and 2 deletions
|
@ -11,7 +11,10 @@ import states from '../utils/states';
|
|||
*/
|
||||
|
||||
const Link = (props) => {
|
||||
const routerLocation = useLocation();
|
||||
let routerLocation;
|
||||
try {
|
||||
routerLocation = useLocation();
|
||||
} catch (e) {}
|
||||
let hash = (location.hash || '').replace(/^#/, '').trim();
|
||||
if (hash === '') hash = '/';
|
||||
const isActive = hash === props.to;
|
||||
|
@ -21,7 +24,7 @@ const Link = (props) => {
|
|||
{...props}
|
||||
class={`${props.class || ''} ${isActive ? 'is-active' : ''}`}
|
||||
onClick={() => {
|
||||
states.prevLocation = routerLocation;
|
||||
if (routerLocation) states.prevLocation = routerLocation;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue