fix: statistics widget and page switch crash issue (#504)

This commit is contained in:
Johnson Cherian 2024-07-16 17:24:01 +05:30 committed by Kavin Venkatachalam
parent fc90a25b52
commit 67cb1455fa
6 changed files with 7 additions and 6 deletions

View file

@ -91,7 +91,7 @@ export const Statistics = function Statistics({ width, height, properties, style
>
{primaryValueLabel}
</p>
<h2 style={primaryStyle}>{primaryValue}</h2>
<h2 style={primaryStyle}>{String(primaryValue)}</h2>
{hideSecondary ? (
''
) : (

View file

@ -29,6 +29,7 @@ export const Tags = function Tags({ width, height, properties, styles, dataCy })
return (
<div style={computedStyles} data-cy={dataCy}>
{data &&
Array.isArray(data) &&
data.map((item, index) => {
return renderTag(item, index);
})}

View file

@ -655,7 +655,7 @@ export const Container = ({
}
if (Object.keys(value)?.length > 0) {
setBoxes((boxes) => {
// Ensure boxes[id] exists
// Ensure boxes[id] exists. This can happen is page is already switched and the component attributes change gets triggered after that
if (!boxes[id]) {
console.error(`Box with id ${id} does not exist`);
return boxes;
@ -677,7 +677,6 @@ export const Container = ({
},
});
});
if (!_.isEmpty(opts)) {
paramUpdatesOptsRef.current = opts;
}

View file

@ -9,8 +9,8 @@
"kind": "runjs",
"exposedVariables": {
"isLoading": false,
"data": {},
"rawData": {}
"data": [],
"rawData": []
},
"customTesting": true,
"disableTransformations": true

View file

@ -1692,6 +1692,7 @@ const EditorComponent = (props) => {
const pageHandle = useCurrentStateStore.getState().page?.handle;
if (currentPageId === pageId && pageHandle === appDefinition?.pages[pageId]?.handle) {
useEditorStore.getState().actions.setPageProgress(false);
return;
}
const { name, handle } = appDefinition.pages[pageId];

View file

@ -1995,5 +1995,5 @@ const isChildOfKanbanModal = (
return parentComponent.component.component === 'Kanban';
}
return parentComponent.type === 'Kanban';
return parentComponent?.type === 'Kanban';
};