From 131a099b2b798e68c3231d3170342a4a18ccd96c Mon Sep 17 00:00:00 2001 From: V3L0C1T13S Date: Fri, 6 May 2022 10:15:41 -0400 Subject: [PATCH] [Feat] make dashboard code cleaner --- renderer/src/builtins/dashboard/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/renderer/src/builtins/dashboard/index.js b/renderer/src/builtins/dashboard/index.js index 7f1fdbfe..445c0efb 100644 --- a/renderer/src/builtins/dashboard/index.js +++ b/renderer/src/builtins/dashboard/index.js @@ -4,7 +4,7 @@ import { SettingsContextMenu } from '@vizality/components/vizality'; import { getModule, contextMenu } from '@vizality/webpack'; -import { forceUpdateElement } from '@vizality/util/react'; +import { forceUpdateElement, findInReactTree } from '@vizality/util/react'; import { patch, unpatch } from '@vizality/patcher'; import { Builtin } from '@vizality/entities'; import { Icon } from '@vizality/components'; @@ -104,17 +104,17 @@ export default class Dashboard extends Builtin { return; } - res.props.children.props.children = [ - ...res.props.children.props.children.slice(0, 0), + const { children: list } = findInReactTree(res, (c) => c.channels); + + list.unshift( } route='/vizality' text='Dashboard' selected={vizality.api.routes.getLocation()?.pathname?.startsWith('/vizality')} onContextMenu={evt => openContextMenu(evt, () => )} - />, - ...res.props.children.props.children.slice(0) - ]; + /> + ); } catch (err) { return this.error(this._labels.concat('_injectPrivateTab'), err); }