From 130c80b174f0f5e0ce630d26360a4f9f804564d8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 30 Jan 2017 16:09:14 +0100 Subject: [PATCH] scroll to top on route change --- .../sonar-web/src/main/js/app/utils/startReactApp.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.js b/server/sonar-web/src/main/js/app/utils/startReactApp.js index e966592aa3a..85efd6a14c1 100644 --- a/server/sonar-web/src/main/js/app/utils/startReactApp.js +++ b/server/sonar-web/src/main/js/app/utils/startReactApp.js @@ -68,6 +68,14 @@ import { globalPermissionsRoutes, projectPermissionsRoutes } from '../../apps/pe import getStore from './getStore'; import getHistory from './getHistory'; +function handleUpdate () { + const { action } = this.state.location; + + if (action === 'PUSH') { + window.scrollTo(0, 0); + } +} + const startReactApp = () => { const el = document.getElementById('content'); @@ -76,7 +84,7 @@ const startReactApp = () => { render(( - + { replace({ pathname: '/dashboard', query: { id: nextState.params.key } }); }}/> -- 2.39.5