Skip to content

Commit 2310074

Browse files
authored
723: Fix SummaryField .includes is not a function (#748)
* Fix SummaryField .includes is not a function - check if row is string before trying .includes. * Change incorrect default customerKey in ContactPersonName field * Add changeset
1 parent 22f1e7b commit 2310074

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.changeset/smooth-walls-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@orchestrator-ui/orchestrator-ui-components": patch
3+
---
4+
5+
723: Fix SummaryField .includes is not a function

packages/orchestrator-ui-components/src/components/WfoForms/formFields/ContactPersonNameField.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ function ContactPersonName({
8989
: name;
9090
const contactsField = useField(useFieldName, {}, { absoluteName: true })[0];
9191

92-
const customerFieldName =
93-
customerKey || contactsField.field.customerKey || 'customer';
92+
const customerIdFieldName =
93+
customerKey || contactsField.field.customerKey || 'customer_id';
9494

9595
// Get initial value for org field if it exists (we cant really test)
9696
let customerInitialValue;
9797
try {
98-
customerInitialValue = schema.getInitialValue(customerFieldName, {});
98+
customerInitialValue = schema.getInitialValue(customerIdFieldName, {});
9999
} catch {
100100
customerInitialValue = '';
101101
}
102102

103103
const customerIdValue =
104104
customerId ||
105105
contactsField.field.customerId ||
106-
get(model, customerFieldName, customerInitialValue);
106+
get(model, customerIdFieldName, customerInitialValue);
107107

108108
const [displayAutocomplete, setDisplayAutocomplete] = useState(false);
109109
const [contactPersons, setContactPersons] = useState<ContactPerson[]>([]);

packages/orchestrator-ui-components/src/components/WfoForms/formFields/SummaryField.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ function Summary({
4646
const { headers, labels, columns } = data;
4747

4848
const extraColumnsData = columns.filter((_, index) => index !== 0);
49-
5049
const rows = columns[0].map((row, index) => (
5150
<tr key={index}>
5251
{labels && <td className={`label`}>{labels[index]}</td>}
5352
<td className={`value`}>
54-
{row.includes('<!doctype html>') ? (
53+
{typeof row === 'string' && row.includes('<!doctype html>') ? (
5554
<div
5655
className="emailMessage"
5756
dangerouslySetInnerHTML={{ __html: row }}

0 commit comments

Comments
 (0)