Commit e4fc556 1 parent 655646d commit e4fc556 Copy full SHA for e4fc556
File tree 2 files changed +33
-0
lines changed
superset-frontend/src/views
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import setupPlugins from 'src/setup/setupPlugins';
35
35
import { routes , isFrontendRoute } from 'src/views/routes' ;
36
36
import { Logger } from 'src/logger/LogUtils' ;
37
37
import { RootContextProviders } from './RootContextProviders' ;
38
+ import { ScrollToTop } from './ScrollToTop' ;
38
39
39
40
setupApp ( ) ;
40
41
setupPlugins ( ) ;
@@ -60,6 +61,7 @@ const LocationPathnameLogger = () => {
60
61
61
62
const App = ( ) => (
62
63
< Router >
64
+ < ScrollToTop />
63
65
< LocationPathnameLogger />
64
66
< RootContextProviders >
65
67
< GlobalStyles />
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ import { useEffect } from 'react' ;
21
+ import { useLocation } from 'react-router-dom' ;
22
+
23
+ export const ScrollToTop = ( ) => {
24
+ const { pathname } = useLocation ( ) ;
25
+
26
+ useEffect ( ( ) => {
27
+ window . scrollTo ( 0 , 0 ) ;
28
+ } , [ pathname ] ) ;
29
+
30
+ return null ;
31
+ } ;
You can’t perform that action at this time.
0 commit comments