Browse Source

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

ref(app): move url change handling to componentDidUpdate
j8
virtuacoplenny 7 years ago
parent
commit
5b45542009
No account linked to committer's email address
1 changed files with 9 additions and 12 deletions
  1. 9
    12
      react/features/app/components/AbstractApp.js

+ 9
- 12
react/features/app/components/AbstractApp.js View File

@@ -56,28 +56,25 @@ export class AbstractApp extends BaseApp<Props, *> {
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 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 69
         this._init.then(() => {
71 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 74
                     // XXX Refer to the implementation of loadURLObject: in
78 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…
Cancel
Save