@flexem/fc-gui 3.0.0-alpha.154 → 3.0.0-alpha.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -66091,10 +66091,18 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
66091
66091
|
ob.next([state]);
|
|
66092
66092
|
});
|
|
66093
66093
|
}
|
|
66094
|
-
//
|
|
66095
|
-
if (_tmp_config["j" /* GuiFeatureConfig */].isOfflineDisplayEnabled && state.state === communication["d" /* VariableStateEnum */].Offline
|
|
66096
|
-
|
|
66097
|
-
|
|
66094
|
+
// 离线时推送最后已知值给值订阅者
|
|
66095
|
+
if (_tmp_config["j" /* GuiFeatureConfig */].isOfflineDisplayEnabled && state.state === communication["d" /* VariableStateEnum */].Offline) {
|
|
66096
|
+
let cachedValue;
|
|
66097
|
+
// 优先用最后一次收到的值(可能是在线时推送的),覆盖所有切页/重连场景
|
|
66098
|
+
if (this.variableValueCache.has(variableName)) {
|
|
66099
|
+
cachedValue = this.variableValueCache.get(variableName).value;
|
|
66100
|
+
}
|
|
66101
|
+
else if (this.offlineValueCache.has(variableName)) {
|
|
66102
|
+
// 兜底:变量从未收到过值,用预加载的离线值
|
|
66103
|
+
cachedValue = this.offlineValueCache.get(variableName);
|
|
66104
|
+
}
|
|
66105
|
+
if (cachedValue !== null && cachedValue !== undefined) {
|
|
66098
66106
|
const variableValue = {
|
|
66099
66107
|
variableName,
|
|
66100
66108
|
value: cachedValue,
|
|
@@ -66108,8 +66116,6 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
66108
66116
|
}
|
|
66109
66117
|
}
|
|
66110
66118
|
}
|
|
66111
|
-
// 无论什么状态,推送后清除缓存,防止后续再次离线时用旧值
|
|
66112
|
-
this.offlineValueCache.delete(variableName);
|
|
66113
66119
|
});
|
|
66114
66120
|
});
|
|
66115
66121
|
}
|