fix: remove scrolling (#37098)

This commit is contained in:
Ahmad Abdolsaheb
2019-10-08 12:00:08 +03:00
committed by mrugesh
parent 6103991d8b
commit 6ed3426128
3 changed files with 0 additions and 27 deletions

View File

@@ -5,7 +5,6 @@ import { bindActionCreators } from 'redux';
import PropTypes from 'prop-types';
import uniq from 'lodash/uniq';
import { createSelector } from 'reselect';
import { scroller } from 'react-scroll';
import SuperBlock from './components/SuperBlock';
import Spacer from '../helpers/Spacer';
@@ -57,21 +56,9 @@ function mapDispatchToProps(dispatch) {
export class Map extends Component {
constructor(props) {
super(props);
this.state = { idToScrollto: null };
this.initializeExpandedState();
}
componentDidMount() {
if (this.state.idToScrollto) {
window.scrollTo(0, 0);
scroller.scrollTo(this.state.idToScrollto, {
duration: 1500,
smooth: 'easeInOutQuint',
offset: -35
});
}
}
// As this happens in the constructor, it's necessary to manipulate state
// directly.
initializeExpandedState() {
@@ -89,16 +76,12 @@ export class Map extends Component {
// find the challenge that has the same superblock with hash
if (hash) {
node = nodes.find(node => dasherize(node.superBlock) === hash);
// eslint-disable-next-line react/no-direct-mutation-state
if (node) this.state = { idToScrollto: dasherize(node.superBlock) };
}
// if there is no hash or the hash did not match any challenge superblock
// and there was a currentChallengeId
if (!node && currentChallengeId) {
node = nodes.find(node => node.id === currentChallengeId);
// eslint-disable-next-line react/no-direct-mutation-state
if (node) this.state = { idToScrollto: dasherize(node.title) };
}
if (!node) node = nodes[0];