Skip to content

Commit e54c3e1

Browse files
fix: BROS-38: Fix sentry issue (i.map is not a function) +1 more (#7662)
Co-authored-by: nikitabelonogov <nikitabelonogov@users.noreply.github.com>
1 parent 0296399 commit e54c3e1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

web/libs/datamanager/src/sdk/comments-sdk.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export class CommentsSdk {
6060

6161
const res = await this.dm.apiCall("listComments", listParams);
6262

63+
// Ensure request is went through and res is an array
64+
if (!res?.length) {
65+
return [];
66+
}
67+
6368
const commentUsers = [];
6469
const comments = res.map((comment) => {
6570
commentUsers.push(comment.created_by);

web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerTree.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ const OutlinerInnerTreeComponent: FC<OutlinerInnerTreeProps> = observer(({ regio
154154
},
155155
): void => {
156156
const region = regionsTree.find((region: any) => region.key === node.key);
157+
158+
if (!region) return;
159+
157160
// pos is equal to label name
158161
const pos = region.pos;
159162

@@ -196,7 +199,7 @@ const OutlinerInnerTreeComponent: FC<OutlinerInnerTreeProps> = observer(({ regio
196199

197200
const useDataTree = ({ regions, rootClass, footer }: any) => {
198201
const processor = useCallback((item: any, idx, _false, _null, _onClick) => {
199-
const { id, type, hidden, isDrawing } = item ?? {};
202+
const { id, type, hidden, isDrawing, locked } = item ?? {};
200203
const style = item?.background ?? item?.getOneColor?.();
201204
const color = chroma(style ?? "#666").alpha(1);
202205
const mods: Record<string, any> = { hidden, type, isDrawing };
@@ -218,7 +221,7 @@ const useDataTree = ({ regions, rootClass, footer }: any) => {
218221
},
219222
className: rootClass.elem("node").mod(mods).toClassName(),
220223
title: (data: any) => <RootTitle {...data} />,
221-
locked: item.locked,
224+
locked,
222225
};
223226
}, []);
224227

0 commit comments

Comments
 (0)