Replace react-router-scroll-4 with inlined implementation (#36253)
This commit is contained in:
1 parent
6d2493ca7c
commit
d801cf8e59
12 files changed
+302
-72
No files matched your search
@@ -5,7 +5,6 @@ import { Route } from 'react-router-dom';
|
||||
|
||||
import { Provider as ReduxProvider } from 'react-redux';
|
||||
|
||||
import { ScrollContext } from 'react-router-scroll-4';
|
||||
|
||||
import { fetchCustomEmojis } from 'mastodon/actions/custom_emojis';
|
||||
import { hydrateStore } from 'mastodon/actions/store';
|
||||
@@ -20,6 +19,8 @@ import { store } from 'mastodon/store';
|
||||
import { isProduction } from 'mastodon/utils/environment';
|
||||
import { BodyScrollLock } from 'mastodon/features/ui/components/body_scroll_lock';
|
||||
|
||||
import { ScrollContext } from './scroll_container/scroll_context';
|
||||
|
||||
const title = isProduction() ? siteTitle : `${siteTitle} (Dev)`;
|
||||
|
||||
const hydrateAction = hydrateStore(initialState);
|
||||
@@ -45,10 +46,6 @@ export default class Mastodon extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
shouldUpdateScroll (prevRouterProps, { location }) {
|
||||
return !(location.state?.mastodonModalKey && location.state?.mastodonModalKey !== prevRouterProps?.location?.state?.mastodonModalKey);
|
||||
}
|
||||
|
||||
render () {
|
||||
return (
|
||||
<IdentityContext.Provider value={this.identity}>
|
||||
@@ -56,7 +53,7 @@ export default class Mastodon extends PureComponent {
|
||||
<ReduxProvider store={store}>
|
||||
<ErrorBoundary>
|
||||
<Router>
|
||||
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
|
||||
<ScrollContext>
|
||||
<Route path='/' component={UI} />
|
||||
</ScrollContext>
|
||||
<BodyScrollLock />
|
||||
|
||||
Reference in new issue
Block a user