diff --git a/packages/react-sdk-components/src/bridge/helpers/sdk_component_map.ts b/packages/react-sdk-components/src/bridge/helpers/sdk_component_map.ts
index 6c398f05..bdd6b599 100644
--- a/packages/react-sdk-components/src/bridge/helpers/sdk_component_map.ts
+++ b/packages/react-sdk-components/src/bridge/helpers/sdk_component_map.ts
@@ -130,19 +130,23 @@ export async function getSdkComponentMap(inLocalComponentMap = {}) {
let idNextCheck;
if (!SdkComponentMap && !SdkComponentMapCreateInProgress) {
SdkComponentMapCreateInProgress = true;
- createSdkComponentMap(inLocalComponentMap).then(theComponentMap => {
- // debugger;
- // Key initialization of SdkComponentMap
- SdkComponentMap = theComponentMap;
- SdkComponentMapCreateInProgress = false;
-
- console.log(`getSdkComponentMap: created SdkComponentMap singleton`);
- // Create and dispatch the SdkConfigAccessReady event
- // Not used anyplace yet but putting it in place in case we need it.
- const event = new CustomEvent('SdkComponentMapReady', {});
- document.dispatchEvent(event);
- return resolve(SdkComponentMap /* .sdkComponentMap */);
- });
+ createSdkComponentMap(inLocalComponentMap)
+ .then(theComponentMap => {
+ // debugger;
+ // Key initialization of SdkComponentMap
+ SdkComponentMap = theComponentMap;
+ SdkComponentMapCreateInProgress = false;
+
+ console.log(`getSdkComponentMap: created SdkComponentMap singleton`);
+ // Create and dispatch the SdkConfigAccessReady event
+ // Not used anyplace yet but putting it in place in case we need it.
+ const event = new CustomEvent('SdkComponentMapReady', {});
+ document.dispatchEvent(event);
+ return resolve(SdkComponentMap /* .sdkComponentMap */);
+ })
+ .catch(e => {
+ console.error(e);
+ });
} else {
const fnCheckForConfig = () => {
if (SdkComponentMap) {
diff --git a/packages/react-sdk-components/src/components/designSystemExtension/Operator/Operator.tsx b/packages/react-sdk-components/src/components/designSystemExtension/Operator/Operator.tsx
index 7e8b32e9..6dfdc9fa 100644
--- a/packages/react-sdk-components/src/components/designSystemExtension/Operator/Operator.tsx
+++ b/packages/react-sdk-components/src/components/designSystemExtension/Operator/Operator.tsx
@@ -80,80 +80,84 @@ export default function Operator(props: OperatorProps) {
const localizedVal = PCore.getLocaleUtils().getLocaleValue;
const localeCategory = 'Operator';
- operatorPreviewPromise.then((res: any) => {
- const fillerString = '---';
- let fields: any = [];
- if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
- fields = [
- {
- id: 'pyPosition',
- name: localizedVal('Position', localeCategory),
- value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
- },
- {
- id: 'pyOrganization',
- name: localizedVal('Organization', localeCategory),
- value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
- },
- {
- id: 'ReportToUserName',
- name: localizedVal('Reports to', localeCategory),
- value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
- },
- {
- id: 'pyTelephone',
- name: localizedVal('Telephone', localeCategory),
- value: res.data.pyOperatorInfo.pyTelephone ? (
- {res.data.pyOperatorInfo.pyTelephone}
- ) : (
- fillerString
- )
- },
- {
- id: 'pyEmailAddress',
- name: localizedVal('Email address', localeCategory),
- value: res.data.pyOperatorInfo.pyEmailAddress ? (
- {res.data.pyOperatorInfo.pyEmailAddress}
- ) : (
- fillerString
- )
- }
- ];
- } else {
- console.log(
- `Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`
- );
- fields = [
- {
- id: 'pyPosition',
- name: localizedVal('Position', localeCategory),
- value: fillerString
- },
- {
- id: 'pyOrganization',
- name: localizedVal('Organization', localeCategory),
- value: fillerString
- },
- {
- id: 'ReportToUserName',
- name: localizedVal('Reports to', localeCategory),
- value: fillerString
- },
- {
- id: 'pyTelephone',
- name: localizedVal('Telephone', localeCategory),
- value: fillerString
- },
- {
- id: 'pyEmailAddress',
- name: localizedVal('Email address', localeCategory),
- value: fillerString
- }
- ];
- }
- // Whatever the fields are, update the component's popoverFields
- setPopoverFields(fields);
- });
+ operatorPreviewPromise
+ .then((res: any) => {
+ const fillerString = '---';
+ let fields: any = [];
+ if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
+ fields = [
+ {
+ id: 'pyPosition',
+ name: localizedVal('Position', localeCategory),
+ value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
+ },
+ {
+ id: 'pyOrganization',
+ name: localizedVal('Organization', localeCategory),
+ value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
+ },
+ {
+ id: 'ReportToUserName',
+ name: localizedVal('Reports to', localeCategory),
+ value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
+ },
+ {
+ id: 'pyTelephone',
+ name: localizedVal('Telephone', localeCategory),
+ value: res.data.pyOperatorInfo.pyTelephone ? (
+ {res.data.pyOperatorInfo.pyTelephone}
+ ) : (
+ fillerString
+ )
+ },
+ {
+ id: 'pyEmailAddress',
+ name: localizedVal('Email address', localeCategory),
+ value: res.data.pyOperatorInfo.pyEmailAddress ? (
+ {res.data.pyOperatorInfo.pyEmailAddress}
+ ) : (
+ fillerString
+ )
+ }
+ ];
+ } else {
+ console.log(
+ `Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`
+ );
+ fields = [
+ {
+ id: 'pyPosition',
+ name: localizedVal('Position', localeCategory),
+ value: fillerString
+ },
+ {
+ id: 'pyOrganization',
+ name: localizedVal('Organization', localeCategory),
+ value: fillerString
+ },
+ {
+ id: 'ReportToUserName',
+ name: localizedVal('Reports to', localeCategory),
+ value: fillerString
+ },
+ {
+ id: 'pyTelephone',
+ name: localizedVal('Telephone', localeCategory),
+ value: fillerString
+ },
+ {
+ id: 'pyEmailAddress',
+ name: localizedVal('Email address', localeCategory),
+ value: fillerString
+ }
+ ];
+ }
+ // Whatever the fields are, update the component's popoverFields
+ setPopoverFields(fields);
+ })
+ .catch(e => {
+ console.error(e);
+ });
setPopoverAnchorEl(event.currentTarget);
}
diff --git a/packages/react-sdk-components/src/components/field/AutoComplete/AutoComplete.tsx b/packages/react-sdk-components/src/components/field/AutoComplete/AutoComplete.tsx
index 5ae8c1cd..828770e9 100644
--- a/packages/react-sdk-components/src/components/field/AutoComplete/AutoComplete.tsx
+++ b/packages/react-sdk-components/src/components/field/AutoComplete/AutoComplete.tsx
@@ -273,9 +273,13 @@ export default function AutoComplete(props: AutoCompleteProps) {
useEffect(() => {
if (!displayMode && listType !== 'associated') {
- getDataPage(datasource, parameters, context).then((results: any) => {
- setOptions(buildOptionsFromResults(results));
- });
+ getDataPage(datasource, parameters, context)
+ .then((results: any) => {
+ setOptions(buildOptionsFromResults(results));
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
}, []);
@@ -309,9 +313,13 @@ export default function AutoComplete(props: AutoCompleteProps) {
const changePromise = (actionsApi as any).triggerFieldChange(propName, val);
if (onRecordChange) {
if (changePromise && changePromise.then) {
- changePromise.then(() => {
- onRecordChange({ ...event, id: val });
- });
+ changePromise
+ .then(() => {
+ onRecordChange({ ...event, id: val });
+ })
+ .catch(e => {
+ console.error(e);
+ });
} else {
onRecordChange({ ...event, id: val });
}
@@ -359,9 +367,13 @@ export default function AutoComplete(props: AutoCompleteProps) {
// Re-fetches the options list (equivalent to initializeList in constellation-frontend)
const refreshOptionsList = () => {
if (!displayMode && listType !== 'associated') {
- getDataPage(datasource, parameters, context).then((results: any) => {
- setOptions(buildOptionsFromResults(results));
- });
+ getDataPage(datasource, parameters, context)
+ .then((results: any) => {
+ setOptions(buildOptionsFromResults(results));
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
};
@@ -409,22 +421,26 @@ export default function AutoComplete(props: AutoCompleteProps) {
if (selectKey && listType !== 'associated' && datasource) {
// Re-fetch data to find the newly created record and set all mapped properties
- getDataPage(datasource, parameters, context).then((results: any) => {
- setOptions(buildOptionsFromResults(results));
-
- // Find the newly created record by ID or caseId and set all properties
- const displayColumn = getDisplayFieldsMetaData(columns);
- const newRecord = results?.find((el: any) => el.ID === data.ID || (el[displayColumn.key] || el.pyGUID) === selectKey);
- if (newRecord) {
- setValuesToAdditionalFields(newRecord);
- } else {
- // Fallback: just set the key value
- handleEvent(actionsApi, 'changeNblur', propName, selectKey);
- }
- if (onRecordChange) {
- onRecordChange({ id: selectKey });
- }
- });
+ getDataPage(datasource, parameters, context)
+ .then((results: any) => {
+ setOptions(buildOptionsFromResults(results));
+
+ // Find the newly created record by ID or caseId and set all properties
+ const displayColumn = getDisplayFieldsMetaData(columns);
+ const newRecord = results?.find((el: any) => el.ID === data.ID || (el[displayColumn.key] || el.pyGUID) === selectKey);
+ if (newRecord) {
+ setValuesToAdditionalFields(newRecord);
+ } else {
+ // Fallback: just set the key value
+ handleEvent(actionsApi, 'changeNblur', propName, selectKey);
+ }
+ if (onRecordChange) {
+ onRecordChange({ id: selectKey });
+ }
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
PCore.getPubSubUtils().unsubscribe(eventType, contextClass);
}
@@ -440,11 +456,15 @@ export default function AutoComplete(props: AutoCompleteProps) {
startingFields: {}
});
- Promise.resolve(triggerCreate).then(() => {
- PCore.getPubSubUtils().subscribe(eventType, createNewCallback, contextClass);
- // Re-initialize the list (equivalent to initializeList() in constellation-frontend)
- refreshOptionsList();
- });
+ Promise.resolve(triggerCreate)
+ .then(() => {
+ PCore.getPubSubUtils().subscribe(eventType, createNewCallback, contextClass);
+ // Re-initialize the list (equivalent to initializeList() in constellation-frontend)
+ refreshOptionsList();
+ })
+ .catch(e => {
+ console.error(e);
+ });
};
const showCreateButton = props.allowCreatingRecords === true;
diff --git a/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx b/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx
index 0aa0fd68..2af8f5e0 100644
--- a/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx
+++ b/packages/react-sdk-components/src/components/field/Dropdown/Dropdown.tsx
@@ -160,23 +160,27 @@ export default function Dropdown(props: DropdownProps) {
useEffect(() => {
if (listType !== 'associated' && typeof datasource === 'string') {
- getDataPage(datasource, parameters, context).then((results: any) => {
- const optionsData: any[] = [];
- const displayColumn = getDisplayFieldsMetaData(columns);
- results?.forEach(element => {
- const val = element[displayColumn.primary]?.toString();
- const obj = {
- key: element[displayColumn.key] || element.pyGUID,
- value: val
- };
- optionsData.push(obj);
+ getDataPage(datasource, parameters, context)
+ .then((results: any) => {
+ const optionsData: any[] = [];
+ const displayColumn = getDisplayFieldsMetaData(columns);
+ results?.forEach(element => {
+ const val = element[displayColumn.primary]?.toString();
+ const obj = {
+ key: element[displayColumn.key] || element.pyGUID,
+ value: val
+ };
+ optionsData.push(obj);
+ });
+ optionsData.unshift({
+ key: placeholder,
+ value: thePConn.getLocalizedValue(placeholder, '', '')
+ });
+ setOptions(optionsData);
+ })
+ .catch(e => {
+ console.error(e);
});
- optionsData.unshift({
- key: placeholder,
- value: thePConn.getLocalizedValue(placeholder, '', '')
- });
- setOptions(optionsData);
- });
}
}, [memoizedParameters]);
diff --git a/packages/react-sdk-components/src/components/field/Multiselect/Multiselect.tsx b/packages/react-sdk-components/src/components/field/Multiselect/Multiselect.tsx
index 553fca82..40eeea7a 100644
--- a/packages/react-sdk-components/src/components/field/Multiselect/Multiselect.tsx
+++ b/packages/react-sdk-components/src/components/field/Multiselect/Multiselect.tsx
@@ -181,6 +181,9 @@ export default function Multiselect(props) {
if (!isGroupData) {
getCaseListBasedOnParamsDebounced.current(inputValue ?? '', '', [...selectedItems], [...itemsTree]);
}
+ })
+ .catch(e => {
+ console.error(e);
});
}
}, [dataConfig, listType, dataConfig.columns, inputValue, dataConfig.groupColumnsConfig, showSecondaryInSearchOnly]);
diff --git a/packages/react-sdk-components/src/components/field/ObjectReference/ObjectReference.tsx b/packages/react-sdk-components/src/components/field/ObjectReference/ObjectReference.tsx
index c09dd30e..fcfa7337 100644
--- a/packages/react-sdk-components/src/components/field/ObjectReference/ObjectReference.tsx
+++ b/packages/react-sdk-components/src/components/field/ObjectReference/ObjectReference.tsx
@@ -178,7 +178,13 @@ export default function ObjectReference(props: ObjectReferenceProps) {
.then((response: any) => {
PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), (response.data as any).data.caseInfo.lastUpdateTime);
PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);
+ })
+ .catch(e => {
+ console.error(e);
});
+ })
+ .catch(e => {
+ console.error(e);
});
}
};
diff --git a/packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx b/packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx
index 80fec520..e915a8be 100644
--- a/packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx
+++ b/packages/react-sdk-components/src/components/field/UserReference/UserReference.tsx
@@ -68,11 +68,15 @@ const UserReference = (props: UserReferenceProps) => {
// if same user ref field is referred in view as editable & readonly formatted text
// referenced users won't be available, so get user details from dx api
const { getOperatorDetails } = PCore.getUserApi();
- getOperatorDetails(userId).then((res: any) => {
- if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
- setUserName(res.data.pyOperatorInfo.pyUserName);
- }
- });
+ getOperatorDetails(userId)
+ .then((res: any) => {
+ if (res.data && res.data.pyOperatorInfo && res.data.pyOperatorInfo.pyUserName) {
+ setUserName(res.data.pyOperatorInfo.pyUserName);
+ }
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
} else if (displayAs === DROPDOWN_LIST) {
const queryPayload = {
diff --git a/packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx b/packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx
index d34e2108..0c709e5a 100644
--- a/packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx
+++ b/packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx
@@ -164,9 +164,14 @@ export default function Assignment(props: PropsWithChildren) {
}
function onSaveActionSuccess(data) {
- actionsAPI.cancelAssignment(itemKey, false).then(() => {
- PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
- });
+ actionsAPI
+ .cancelAssignment(itemKey, false)
+ .then(() => {
+ PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
function buttonPress(sAction: string, sButtonType: string) {
diff --git a/packages/react-sdk-components/src/components/infra/DeferLoad/DeferLoad.tsx b/packages/react-sdk-components/src/components/infra/DeferLoad/DeferLoad.tsx
index 6ba65768..7af5f28a 100644
--- a/packages/react-sdk-components/src/components/infra/DeferLoad/DeferLoad.tsx
+++ b/packages/react-sdk-components/src/components/infra/DeferLoad/DeferLoad.tsx
@@ -125,6 +125,9 @@ export default function DeferLoad(props: DeferLoadProps) {
})
.then(data => {
onResponse(data);
+ })
+ .catch(e => {
+ console.error(e);
});
} else {
console.error('Cannot load the defer loaded view without container information');
@@ -136,6 +139,9 @@ export default function DeferLoad(props: DeferLoadProps) {
.loadView(encodeURI(loadViewCaseID), name, getViewOptions())
.then(data => {
onResponse(data);
+ })
+ .catch(e => {
+ console.error(e);
});
} else if (template === 'HierarchicalForm') {
const root = {
diff --git a/packages/react-sdk-components/src/components/template/AppShell/AppShell.tsx b/packages/react-sdk-components/src/components/template/AppShell/AppShell.tsx
index 388a3f24..f92f3342 100644
--- a/packages/react-sdk-components/src/components/template/AppShell/AppShell.tsx
+++ b/packages/react-sdk-components/src/components/template/AppShell/AppShell.tsx
@@ -134,6 +134,9 @@ export default function AppShell(props: PropsWithChildren) {
skipDirtyValidation: true
});
}
+ })
+ .catch(e => {
+ console.error(e);
});
}
}, []);
@@ -170,7 +173,10 @@ export default function AppShell(props: PropsWithChildren) {
if (imageKey && portalTemplate === 'wss') {
PCore.getAssetLoader()
.getSvcImageUrl(imageKey)
- .then(imagePath => setImageBlobUrl(imagePath));
+ .then(imagePath => setImageBlobUrl(imagePath))
+ .catch(e => {
+ console.error(e);
+ });
}
}, []);
diff --git a/packages/react-sdk-components/src/components/template/DataReference/DataReference.tsx b/packages/react-sdk-components/src/components/template/DataReference/DataReference.tsx
index 2f008aa2..a3a8a951 100644
--- a/packages/react-sdk-components/src/components/template/DataReference/DataReference.tsx
+++ b/packages/react-sdk-components/src/components/template/DataReference/DataReference.tsx
@@ -222,41 +222,49 @@ export default function DataReference(props: PropsWithChildren).then(caseResponse => {
- const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
- let curr = {};
- const commitData = curr;
-
- pageTokens.forEach(el => {
- if (el !== '') {
- curr[el] = {};
- curr = curr[el];
- }
- });
+ (PCore.getDataApiUtils().getCaseEditLock(caseKey, '') as Promise)
+ .then(caseResponse => {
+ const pageTokens = pConn.getPageReference().replace('caseInfo.content', '').split('.');
+ let curr = {};
+ const commitData = curr;
+
+ pageTokens.forEach(el => {
+ if (el !== '') {
+ curr[el] = {};
+ curr = curr[el];
+ }
+ });
- // expecting format like {Customer: {pyID:"C-100"}}
- const propArr = propName.split('.');
- propArr.forEach((element, idx) => {
- if (idx + 1 === propArr.length) {
- curr[element] = propValue;
- } else {
- curr[element] = {};
- curr = curr[element];
- }
- });
+ // expecting format like {Customer: {pyID:"C-100"}}
+ const propArr = propName.split('.');
+ propArr.forEach((element, idx) => {
+ if (idx + 1 === propArr.length) {
+ curr[element] = propValue;
+ } else {
+ curr[element] = {};
+ curr = curr[element];
+ }
+ });
- (
- PCore.getDataApiUtils().updateCaseEditFieldsData(
- caseKey,
- { [caseKey]: commitData },
- caseResponse.headers.etag,
- pConn.getContextName()
- ) as Promise
- ).then(response => {
- PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), response.data.data.caseInfo.lastUpdateTime);
- PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);
+ (
+ PCore.getDataApiUtils().updateCaseEditFieldsData(
+ caseKey,
+ { [caseKey]: commitData },
+ caseResponse.headers.etag,
+ pConn.getContextName()
+ ) as Promise
+ )
+ .then(response => {
+ PCore.getContainerUtils().updateParentLastUpdateTime(pConn.getContextName(), response.data.data.caseInfo.lastUpdateTime);
+ PCore.getContainerUtils().updateRelatedContextEtag(pConn.getContextName(), response.headers.etag);
+ })
+ .catch(e => {
+ console.error(e);
+ });
+ })
+ .catch(e => {
+ console.error(e);
});
- });
}
};
diff --git a/packages/react-sdk-components/src/components/template/ListView/ListView.tsx b/packages/react-sdk-components/src/components/template/ListView/ListView.tsx
index 7edd29e7..a473157a 100644
--- a/packages/react-sdk-components/src/components/template/ListView/ListView.tsx
+++ b/packages/react-sdk-components/src/components/template/ListView/ListView.tsx
@@ -78,7 +78,6 @@ let sortColumnId: any;
const filterByColumns: any[] = [];
export default function ListView(props: ListViewProps) {
- console.log('ListView props', props);
const { getPConnect, bInForm = true } = props;
const {
globalSearch,
@@ -562,70 +561,74 @@ export default function ListView(props: ListViewProps) {
async function fetchDataFromServer(overrideParams?: any) {
let bCallSetRowsColumns = true;
- const { fieldDefs, itemKey, patchQueryFields } = meta;
- let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
- listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
- const workListJSON = await fetchAllData(listFields, overrideParams);
+ try {
+ const { fieldDefs, itemKey, patchQueryFields } = meta;
+ let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
+ listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
+ const workListJSON = await fetchAllData(listFields, overrideParams);
- // this is an unresovled version of this.fields$, need unresolved, so can get the property reference
- const columnFields = componentConfig.presets[0].children[0].children;
+ // this is an unresovled version of this.fields$, need unresolved, so can get the property reference
+ const columnFields = componentConfig.presets[0].children[0].children;
- const tableDataResults = !bInForm ? workListJSON.data.data : workListJSON.data;
+ const tableDataResults = !bInForm ? workListJSON.data.data : workListJSON.data;
- const myColumns = getHeaderCells(columnFields, fieldDefs);
+ const myColumns = getHeaderCells(columnFields, fieldDefs);
- const selectParams: any = [];
+ const selectParams: any = [];
- myColumns.forEach(column => {
- column.label = PCore.getLocaleUtils().getLocaleValue(column.label, localeReference);
- selectParams.push({
- field: column.id
+ myColumns.forEach(column => {
+ column.label = PCore.getLocaleUtils().getLocaleValue(column.label, localeReference);
+ selectParams.push({
+ field: column.id
+ });
});
- });
- const colList: any = [];
+ const colList: any = [];
- selectParams.forEach(col => {
- colList.push(col.field);
- });
+ selectParams.forEach(col => {
+ colList.push(col.field);
+ });
- columnList.current = colList;
+ columnList.current = colList;
- setResponse(tableDataResults);
+ setResponse(tableDataResults);
- const usingDataResults = getUsingData(tableDataResults);
+ const usingDataResults = getUsingData(tableDataResults);
- // store globally, so can be searched, filtered, etc.
- myRows = usingDataResults;
+ // store globally, so can be searched, filtered, etc.
+ myRows = usingDataResults;
- setRowsData(myRows);
- // At this point, if we have data ready to render and haven't been asked
- // to NOT call setRows and setColumns, call them
- if (bCallSetRowsColumns) {
- setRows(myRows);
- setColumns(myColumns);
+ setRowsData(myRows);
+ // At this point, if we have data ready to render and haven't been asked
+ // to NOT call setRows and setColumns, call them
+ if (bCallSetRowsColumns) {
+ setRows(myRows);
+ setColumns(myColumns);
- if (selectionMode === SELECTION_MODE.MULTI && selectedValues?.length > 0) {
- const readonlyIds = new Set(selectedValues.map((element: any) => element[rowID]));
- const initialSet = new Set();
- myRows?.forEach(row => {
- if (readonlyIds.has(row[rowID])) {
- initialSet.add(row[rowID]);
- }
- });
- setSelectedRowSet(initialSet);
+ if (selectionMode === SELECTION_MODE.MULTI && selectedValues?.length > 0) {
+ const readonlyIds = new Set(selectedValues.map((element: any) => element[rowID]));
+ const initialSet = new Set();
+ myRows?.forEach(row => {
+ if (readonlyIds.has(row[rowID])) {
+ initialSet.add(row[rowID]);
+ }
+ });
+ setSelectedRowSet(initialSet);
+ }
}
- }
- return () => {
- // Inspired by https://juliangaramendy.dev/blog/use-promise-subscription
- // The useEffect closure lets us have access to the bCallSetRowsColumns
- // variable inside the useEffect and inside the "then" clause of the
- // workListData promise
- // So, if this cleanup code gets run before the promise .then is called,
- // we can avoid calling the useState setters which would otherwise show a warning
- bCallSetRowsColumns = false;
- };
+ return () => {
+ // Inspired by https://juliangaramendy.dev/blog/use-promise-subscription
+ // The useEffect closure lets us have access to the bCallSetRowsColumns
+ // variable inside the useEffect and inside the "then" clause of the
+ // workListData promise
+ // So, if this cleanup code gets run before the promise .then is called,
+ // we can avoid calling the useState setters which would otherwise show a warning
+ bCallSetRowsColumns = false;
+ };
+ } catch (e) {
+ console.error(e);
+ }
}
function prepareFilters(data) {
diff --git a/packages/react-sdk-components/src/components/template/ListView/hooks.ts b/packages/react-sdk-components/src/components/template/ListView/hooks.ts
index 9b96afc1..35893f8d 100644
--- a/packages/react-sdk-components/src/components/template/ListView/hooks.ts
+++ b/packages/react-sdk-components/src/components/template/ListView/hooks.ts
@@ -135,18 +135,22 @@ export default function useInit(props) {
compositeKeys,
isSearchable,
isCacheable: true
- }).then(async context => {
- if (isCompStillMounted) {
- return readContextResponse(context, {
- ...props,
- editing,
- selectionCountThreshold,
- ref,
- selectionMode,
- cosmosTableRef
- });
- }
- });
+ })
+ .then(async context => {
+ if (isCompStillMounted) {
+ return readContextResponse(context, {
+ ...props,
+ editing,
+ selectionCountThreshold,
+ ref,
+ selectionMode,
+ cosmosTableRef
+ });
+ }
+ })
+ .catch(e => {
+ console.error(e);
+ });
})();
return () => {
diff --git a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx
index 729083d4..a6666a2b 100644
--- a/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx
+++ b/packages/react-sdk-components/src/components/widget/Attachment/Attachment.tsx
@@ -328,9 +328,14 @@ export default function Attachment(props: AttachmentProps) {
useEffect(() => {
if (toggleUploadBegin && files.length > 0) {
- actionSequencer.registerBlockingAction(contextName).then(() => {
- uploadFiles();
- });
+ actionSequencer
+ .registerBlockingAction(contextName)
+ .then(() => {
+ uploadFiles();
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
}, [toggleUploadBegin]);
diff --git a/packages/react-sdk-components/src/components/widget/CaseHistory/CaseHistory.tsx b/packages/react-sdk-components/src/components/widget/CaseHistory/CaseHistory.tsx
index c1153a7e..56562db1 100644
--- a/packages/react-sdk-components/src/components/widget/CaseHistory/CaseHistory.tsx
+++ b/packages/react-sdk-components/src/components/widget/CaseHistory/CaseHistory.tsx
@@ -101,18 +101,22 @@ export default function CaseHistory(props: CaseHistoryProps) {
context
) as Promise;
- historyData.then((historyJSON: any) => {
- const tableDataResults = historyJSON.data.data;
-
- // compute the rowData using the tableDataResults
- computeRowData(tableDataResults);
-
- // At this point, if we have data ready to render and haven't been asked
- // to NOT call setWaitingForData, we can stop progress indicator
- if (bCallSetWaitingForData) {
- setWaitingForData(false);
- }
- });
+ historyData
+ .then((historyJSON: any) => {
+ const tableDataResults = historyJSON.data.data;
+
+ // compute the rowData using the tableDataResults
+ computeRowData(tableDataResults);
+
+ // At this point, if we have data ready to render and haven't been asked
+ // to NOT call setWaitingForData, we can stop progress indicator
+ if (bCallSetWaitingForData) {
+ setWaitingForData(false);
+ }
+ })
+ .catch(e => {
+ console.error(e);
+ });
return () => {
// Inspired by https://juliangaramendy.dev/blog/use-promise-subscription
diff --git a/packages/react-sdk-components/src/components/widget/FileUtility/FileUtility/FileUtility.tsx b/packages/react-sdk-components/src/components/widget/FileUtility/FileUtility/FileUtility.tsx
index 3d19efd4..4747bc39 100644
--- a/packages/react-sdk-components/src/components/widget/FileUtility/FileUtility/FileUtility.tsx
+++ b/packages/react-sdk-components/src/components/widget/FileUtility/FileUtility/FileUtility.tsx
@@ -195,7 +195,9 @@ export default function FileUtility(props: FileUtilityProps) {
window.open(content.data, '_blank');
}
})
- .catch();
+ .catch(e => {
+ console.error(e);
+ });
}
function deleteAttachedFile(att: any) {
@@ -208,7 +210,9 @@ export default function FileUtility(props: FileUtilityProps) {
.then(() => {
getAttachments();
})
- .catch();
+ .catch(e => {
+ console.error(e);
+ });
}
const getAttachments = () => {
@@ -217,33 +221,37 @@ export default function FileUtility(props: FileUtilityProps) {
if (caseID && caseID !== '') {
const attPromise = attachmentUtils.getCaseAttachments(caseID, thePConn.getContextName());
- attPromise.then((resp: any) => {
- const arFullListAttachments = addAttachments(resp);
- const attachmentsCount = arFullListAttachments.length;
- const arItems: any = arFullListAttachments.slice(0, 3).map(att => {
- return getListUtilityItemProps({
- att,
- downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
- cancelFile: null,
- deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
- removeFile: null
+ attPromise
+ .then((resp: any) => {
+ const arFullListAttachments = addAttachments(resp);
+ const attachmentsCount = arFullListAttachments.length;
+ const arItems: any = arFullListAttachments.slice(0, 3).map(att => {
+ return getListUtilityItemProps({
+ att,
+ downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
+ cancelFile: null,
+ deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
+ removeFile: null
+ });
});
- });
- const viewAllarItems: any = arFullListAttachments.map(att => {
- return getListUtilityItemProps({
- att,
- downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
- cancelFile: null,
- deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
- removeFile: null
+ const viewAllarItems: any = arFullListAttachments.map(att => {
+ return getListUtilityItemProps({
+ att,
+ downloadFile: !att.progress ? () => downloadAttachedFile(att) : null,
+ cancelFile: null,
+ deleteFile: !att.progress ? () => deleteAttachedFile(att) : null,
+ removeFile: null
+ });
});
+ setProgress(false);
+ setList(current => {
+ return { ...current, count: attachmentsCount, data: arItems };
+ });
+ setFullAttachments(viewAllarItems);
+ })
+ .catch(e => {
+ console.error(e);
});
- setProgress(false);
- setList(current => {
- return { ...current, count: attachmentsCount, data: arItems };
- });
- setFullAttachments(viewAllarItems);
- });
}
};
@@ -373,10 +381,14 @@ export default function FileUtility(props: FileUtilityProps) {
});
getAttachments();
})
- .catch();
+ .catch(e => {
+ console.error(e);
+ });
}
})
- .catch();
+ .catch(e => {
+ console.error(e);
+ });
}
function onAddLinksClick() {
diff --git a/packages/react-sdk-components/src/components/widget/ToDo/ToDo.tsx b/packages/react-sdk-components/src/components/widget/ToDo/ToDo.tsx
index 403a0254..5ac6bd8a 100644
--- a/packages/react-sdk-components/src/components/widget/ToDo/ToDo.tsx
+++ b/packages/react-sdk-components/src/components/widget/ToDo/ToDo.tsx
@@ -165,9 +165,13 @@ export default function ToDo(props: ToDoProps) {
useEffect(() => {
if (Object.keys(myWorkList).length && myWorkList.datapage) {
- fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {
- deferLoadWorklistItems(responseData);
- });
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context)
+ .then(responseData => {
+ deferLoadWorklistItems(responseData);
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
}, []);
@@ -203,9 +207,13 @@ export default function ToDo(props: ToDoProps) {
function _showMore() {
setBShowMore(false);
if (type === CONSTS.WORKLIST && count && count > assignments.length && !assignmentsSource) {
- fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, count, false, context).then(response => {
- setAssignments(response.data);
- });
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, count, false, context)
+ .then(response => {
+ setAssignments(response.data);
+ })
+ .catch(e => {
+ console.error(e);
+ });
} else {
setAssignments(assignmentsSource);
}
diff --git a/packages/react-sdk-components/src/mediaco/ToDo/ToDo.tsx b/packages/react-sdk-components/src/mediaco/ToDo/ToDo.tsx
index 3faacfc2..31f5c768 100644
--- a/packages/react-sdk-components/src/mediaco/ToDo/ToDo.tsx
+++ b/packages/react-sdk-components/src/mediaco/ToDo/ToDo.tsx
@@ -169,9 +169,13 @@ export default function ToDo(props: ToDoProps) {
useEffect(() => {
if (Object.keys(myWorkList).length && myWorkList.datapage) {
- fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context).then(responseData => {
- deferLoadWorklistItems(responseData);
- });
+ fetchMyWorkList(myWorkList.datapage, getPConnect().getComponentConfig()?.myWorkList.fields, 3, true, context)
+ .then(responseData => {
+ deferLoadWorklistItems(responseData);
+ })
+ .catch(e => {
+ console.error(e);
+ });
}
}, []);