Skip to content
Snippets Groups Projects
Unverified Commit 97a030fc authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub
Browse files

[FIX] React being loaded on the main bundle (#18597)

parent 25c7099d
No related branches found
No related tags found
No related merge requests found
import { hasPermission } from '../../app/authorization/client';
import { createTemplateForComponent } from '../reactAdapters';
import { settings } from '../../app/settings';
import { createSidebarItems } from '../components/basic/Sidebar';
import { createSidebarItems } from '../helpers/createSidebarItems';
createTemplateForComponent('accountFlex', () => import('./AccountSidebar'));
......
......@@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { hasPermission, hasRole } from '../../app/authorization/client';
import { createTemplateForComponent } from '../reactAdapters';
import { createSidebarItems } from '../components/basic/Sidebar';
import { createSidebarItems } from '../helpers/createSidebarItems';
createTemplateForComponent('adminFlex', () => import('./sidebar/AdminSidebar'));
......
......@@ -5,32 +5,6 @@ import { Box, Scrollable, Button, Icon } from '@rocket.chat/fuselage';
import { useTranslation } from '../../contexts/TranslationContext';
import { useRoutePath } from '../../contexts/RouterContext';
export const createSidebarItems = (initialItems = []) => {
const items = initialItems;
let updateCb = () => {};
const itemsSubscription = {
subscribe: (cb) => {
updateCb = cb;
return () => {
updateCb = () => {};
};
},
getCurrentValue: () => items,
};
const registerSidebarItem = (item) => {
items.push(item);
updateCb();
};
const unregisterSidebarItem = (label) => {
const index = items.findIndex(({ i18nLabel }) => i18nLabel === label);
delete items[index];
updateCb();
};
return { registerSidebarItem, unregisterSidebarItem, itemsSubscription };
};
const Sidebar = ({ children, ...props }) => <Box display='flex' flexDirection='column' h='100vh' {...props}>
{children}
</Box>;
......
export const createSidebarItems = (initialItems = []) => {
const items = initialItems;
let updateCb = () => {};
const itemsSubscription = {
subscribe: (cb) => {
updateCb = cb;
return () => {
updateCb = () => {};
};
},
getCurrentValue: () => items,
};
const registerSidebarItem = (item) => {
items.push(item);
updateCb();
};
const unregisterSidebarItem = (label) => {
const index = items.findIndex(({ i18nLabel }) => i18nLabel === label);
delete items[index];
updateCb();
};
return { registerSidebarItem, unregisterSidebarItem, itemsSubscription };
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment