MCPcopy Index your code
hub / github.com/plotly/dash / updateLocation

Function updateLocation

components/dash-core-components/src/components/Link.react.js:46–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 1

pushStateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…