| 44 | const loading = ctx.useLoading(); |
| 45 | |
| 46 | const updateLocation = e => { |
| 47 | const hasModifiers = e.metaKey || e.shiftKey || e.altKey || e.ctrlKey; |
| 48 | |
| 49 | if (hasModifiers) { |
| 50 | return; |
| 51 | } |
| 52 | if (target !== '_self' && !isNil(target)) { |
| 53 | return; |
| 54 | } |
| 55 | // prevent anchor from updating location |
| 56 | e.preventDefault(); |
| 57 | if (refresh) { |
| 58 | window.location = sanitizedUrl; |
| 59 | } else { |
| 60 | window.history.pushState({}, '', sanitizedUrl); |
| 61 | window.dispatchEvent(new CustomEvent('_dashprivate_pushstate')); |
| 62 | } |
| 63 | // scroll back to top |
| 64 | window.scrollTo(0, 0); |
| 65 | }; |
| 66 | |
| 67 | useEffect(() => { |
| 68 | if (sanitizedUrl && sanitizedUrl !== href) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…