diff --git a/renderer/src/builtins/dashboard/index.js b/renderer/src/builtins/dashboard/index.js index 7f1fdbfe..feb4cb5e 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'; @@ -100,21 +100,19 @@ export default class Dashboard extends Builtin { const { LinkButton } = getModule('LinkButton'); patch('vz-dashboard-private-channels-list-item', ConnectedPrivateChannelsList, 'default', (_, res) => { try { - if (!res.props?.children?.props?.children) { - return; - } + const { children: list } = findInReactTree(res, (c) => c.channels); - res.props.children.props.children = [ - ...res.props.children.props.children.slice(0, 0), + if (!list) return; + + 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); }