fix crash when loadedWidgets is not a array

This commit is contained in:
SrGooglo 2023-05-17 16:59:17 +00:00
parent 3e49de7a0f
commit b2127fc0d6

View File

@ -16,24 +16,26 @@ export default class WidgetsView extends React.Component {
return <div className="widgets_load"> return <div className="widgets_load">
<div className="widgets_load_list"> <div className="widgets_load_list">
{ {
this.state.loadedWidgets.map((manifest) => { Array.isArray(this.state.loadedWidgets) && this.state.loadedWidgets.map((manifest) => {
return <WidgetItemPreview return <React.Fragment>
manifest={manifest} <WidgetItemPreview
onRemove={() => { manifest={manifest}
app.cores.widgets.uninstall(manifest._id) onRemove={() => {
}} app.cores.widgets.uninstall(manifest._id)
onInstall={() => { }}
app.cores.widgets.install(manifest._id) onInstall={() => {
}} app.cores.widgets.install(manifest._id)
onUpdate={() => { }}
app.cores.widgets.install(manifest._id, { onUpdate={() => {
update: true, app.cores.widgets.install(manifest._id, {
}) update: true,
}} })
onChangeVisible={(visible) => { }}
app.cores.widgets.toogleVisibility(manifest._id, visible) onChangeVisible={(visible) => {
}} app.cores.widgets.toogleVisibility(manifest._id, visible)
/> }}
/>
</React.Fragment>
}) })
} }