Pārlūkot izejas kodu

delete some no no needrequestAnimationFrame

陈帅 7 gadi atpakaļ
vecāks
revīzija
868f84a632

+ 1 - 3
src/components/Charts/Radar/index.js

@@ -12,9 +12,7 @@ export default class Radar extends Component {
   };
 
   componentDidMount() {
-    requestAnimationFrame(() => {
-      this.getLegendData();
-    });
+    this.getLegendData();
   }
 
   componentDidUpdate(preProps) {

+ 2 - 4
src/components/Charts/WaterWave/index.js

@@ -13,10 +13,8 @@ export default class WaterWave extends PureComponent {
   };
 
   componentDidMount() {
-    requestAnimationFrame(() => {
-      this.renderChart();
-      this.resize();
-    });
+    this.renderChart();
+    this.resize();
     window.addEventListener(
       'resize',
       () => {

+ 11 - 13
src/routes/Profile/AdvancedProfile.js

@@ -212,19 +212,17 @@ export default class AdvancedProfile extends Component {
   @Bind()
   @Debounce(200)
   setStepDirection() {
-    requestAnimationFrame(() => {
-      const { stepDirection } = this.state;
-      const w = getWindowWidth();
-      if (stepDirection !== 'vertical' && w <= 576) {
-        this.setState({
-          stepDirection: 'vertical',
-        });
-      } else if (stepDirection !== 'horizontal' && w > 576) {
-        this.setState({
-          stepDirection: 'horizontal',
-        });
-      }
-    });
+    const { stepDirection } = this.state;
+    const w = getWindowWidth();
+    if (stepDirection !== 'vertical' && w <= 576) {
+      this.setState({
+        stepDirection: 'vertical',
+      });
+    } else if (stepDirection !== 'horizontal' && w > 576) {
+      this.setState({
+        stepDirection: 'horizontal',
+      });
+    }
   }
 
   render() {