From 8d8186b4c341b833c17786eb3bbaa3ac80fbdd2d Mon Sep 17 00:00:00 2001 From: ArthurZheng <869705086@qq.com> Date: Sat, 21 Dec 2024 18:05:46 +0800 Subject: [PATCH] If no valid devices data is obtained, the device library data still needs to be generated. --- src/lib/vm-listener-hoc.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/vm-listener-hoc.jsx b/src/lib/vm-listener-hoc.jsx index 3b5594cb8d4..1b7b286fac8 100644 --- a/src/lib/vm-listener-hoc.jsx +++ b/src/lib/vm-listener-hoc.jsx @@ -65,10 +65,11 @@ const vmListenerHOC = function (WrappedComponent) { this.props.vm.postIOData('userData', {username: this.props.username}); // Update device list this.props.vm.extensionManager.getDeviceList().then(data => { - if (data) { - this.props.onSetDeviceData(makeDeviceLibrary(data)); - } - }); + this.props.onSetDeviceData(makeDeviceLibrary(data)); + }) + .catch(() => { + this.props.onSetDeviceData(makeDeviceLibrary()); + }); } componentDidUpdate (prevProps) { if (prevProps.username !== this.props.username) {