diff --git a/app/containers/UIKit/Actions.tsx b/app/containers/UIKit/Actions.tsx
index 1d5ba9840..801e8d4ae 100644
--- a/app/containers/UIKit/Actions.tsx
+++ b/app/containers/UIKit/Actions.tsx
@@ -3,25 +3,18 @@ import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
import Button from '../Button';
import I18n from '../../i18n';
-
-interface IActions {
- blockId: string;
- appId: string;
- elements: any[];
- parser: any;
- theme: string;
-}
+import { IActions } from './interfaces';
export const Actions = ({ blockId, appId, elements, parser, theme }: IActions) => {
- const [showMoreVisible, setShowMoreVisible] = useState(() => elements.length > 5);
- const renderedElements = showMoreVisible ? elements.slice(0, 5) : elements;
+ const [showMoreVisible, setShowMoreVisible] = useState(() => elements && elements.length > 5);
+ const renderedElements = showMoreVisible ? elements?.slice(0, 5) : elements;
- const Elements = () =>
- renderedElements.map((element: any) => parser.renderActions({ blockId, appId, ...element }, BLOCK_CONTEXT.ACTION, parser));
+ const Elements = () => (
+ <>{renderedElements?.map(element => parser?.renderActions({ blockId, appId, ...element }, BLOCK_CONTEXT.ACTION, parser))}>
+ );
return (
<>
- {/* @ts-ignore*/}
{showMoreVisible &&