瀏覽代碼

[RN] Fix processing outdated loadConfig requests

This fix is based on storing the location URL object we are loading the
configuration for in the redux store. Once the config has been loaded (or it has
failed, for that matter!) we'll check if the current "config URL" is the same we
set, and discard the old one if they don't match.
master
Saúl Ibarra Corretgé 7 年之前
父節點
當前提交
357b206831
共有 2 個檔案被更改,包括 14 行新增3 行删除
  1. 12
    2
      react/features/app/actions.js
  2. 2
    1
      react/features/base/config/reducer.js

+ 12
- 2
react/features/app/actions.js 查看文件

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
+import type { Dispatch } from 'redux';
4
+
3
 import { setRoom } from '../base/conference';
5
 import { setRoom } from '../base/conference';
4
 import {
6
 import {
5
     configWillLoad,
7
     configWillLoad,
71
      * @returns {void}
73
      * @returns {void}
72
      */
74
      */
73
     function loadConfigSettled(error, config) {
75
     function loadConfigSettled(error, config) {
74
-        // FIXME Due to the asynchronous nature of the loading, the specified
76
+        // Due to the asynchronous nature of the loading, the specified
75
         // config may or may not be required by the time the notification
77
         // config may or may not be required by the time the notification
76
-        // arrives.
78
+        // arrives. If we receive the config for a location we are no longer
79
+        // interested in, just dump it.
80
+
81
+        const { locationURL: currentLocationURL }
82
+            = getState()['features/base/config'];
83
+
84
+        if (currentLocationURL !== newLocation) {
85
+            throw new Error('Config no longer needed');
86
+        }
77
 
87
 
78
         const promise
88
         const promise
79
             = dispatch(setLocationURL(new URL(newLocation.toString())));
89
             = dispatch(setLocationURL(new URL(newLocation.toString())));

+ 2
- 1
react/features/base/config/reducer.js 查看文件

53
         switch (action.type) {
53
         switch (action.type) {
54
         case CONFIG_WILL_LOAD:
54
         case CONFIG_WILL_LOAD:
55
             return {
55
             return {
56
-                error: undefined
56
+                error: undefined,
57
+                locationURL: action.locationURL
57
             };
58
             };
58
 
59
 
59
         case LOAD_CONFIG_ERROR:
60
         case LOAD_CONFIG_ERROR:

Loading…
取消
儲存