Преглед изворни кода

Merge pull request #3764 from virtuacoplenny/lenny/no-cwrp-abstract-app

ref(app): move url change handling to componentDidUpdate
j8
virtuacoplenny пре 7 година
родитељ
комит
5b45542009
No account linked to committer's email address
1 измењених фајлова са 9 додато и 12 уклоњено
  1. 9
    12
      react/features/app/components/AbstractApp.js

+ 9
- 12
react/features/app/components/AbstractApp.js Прегледај датотеку

56
     }
56
     }
57
 
57
 
58
     /**
58
     /**
59
-     * Notifies this mounted React {@code Component} that it will receive new
60
-     * props. Makes sure that this {@code AbstractApp} has a redux store to use.
59
+     * Implements React Component's componentDidUpdate.
61
      *
60
      *
62
      * @inheritdoc
61
      * @inheritdoc
63
-     * @param {Object} nextProps - The read-only React {@code Component} props
64
-     * that this instance will receive.
65
-     * @returns {void}
66
      */
62
      */
67
-    componentWillReceiveProps(nextProps: Props) {
68
-        const { props } = this;
63
+    componentDidUpdate(prevProps: Props) {
64
+        const previousUrl = toURLString(prevProps.url);
65
+        const currentUrl = toURLString(this.props.url);
66
+        const previousTimestamp = prevProps.timestamp;
67
+        const currentTimestamp = this.props.timestamp;
69
 
68
 
70
         this._init.then(() => {
69
         this._init.then(() => {
71
             // Deal with URL changes.
70
             // Deal with URL changes.
72
-            let { url } = nextProps;
73
 
71
 
74
-            url = toURLString(url);
75
-            if (toURLString(props.url) !== url
72
+            if (previousUrl !== currentUrl
76
 
73
 
77
                     // XXX Refer to the implementation of loadURLObject: in
74
                     // XXX Refer to the implementation of loadURLObject: in
78
                     // ios/sdk/src/JitsiMeetView.m for further information.
75
                     // ios/sdk/src/JitsiMeetView.m for further information.
79
-                    || props.timestamp !== nextProps.timestamp) {
80
-                this._openURL(url || this._getDefaultURL());
76
+                    || previousTimestamp !== currentTimestamp) {
77
+                this._openURL(currentUrl || this._getDefaultURL());
81
             }
78
             }
82
         });
79
         });
83
     }
80
     }

Loading…
Откажи
Сачувај