From 680bc1602101b361c5d115426584594ed5e2b426 Mon Sep 17 00:00:00 2001
From: adamPrestor <adam.prestor@gmail.com>
Date: Fri, 15 Sep 2023 14:57:18 +0200
Subject: [PATCH] Show the value of choice field on DList

---
 .../src/components/api_consumer/consumer-logic-array.ts     | 6 ------
 vue/dynamicforms/src/components/form/field.vue              | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/vue/dynamicforms/src/components/api_consumer/consumer-logic-array.ts b/vue/dynamicforms/src/components/api_consumer/consumer-logic-array.ts
index 1afae6bd..26926202 100644
--- a/vue/dynamicforms/src/components/api_consumer/consumer-logic-array.ts
+++ b/vue/dynamicforms/src/components/api_consumer/consumer-logic-array.ts
@@ -108,12 +108,6 @@ class ConsumerLogicArray extends ConsumerLogicBase implements APIConsumer.Consum
       record = { ...this.formData };
       this.records.push(record);
     }
-    // this loop will fill any resolved display fields into the table record so that resolved names may be displayed
-    this.tableColumns.forEach((column) => {
-      if (column.name.endsWith('-display') && this.formData['$extra-data'][column.name]) {
-        record[column.name] = this.formData['$extra-data'][column.name];
-      }
-    });
     if (refresh) {
       await this.reload();
     }
diff --git a/vue/dynamicforms/src/components/form/field.vue b/vue/dynamicforms/src/components/form/field.vue
index 8cc7e946..69476ded 100644
--- a/vue/dynamicforms/src/components/form/field.vue
+++ b/vue/dynamicforms/src/components/form/field.vue
@@ -82,7 +82,7 @@ export default /* #__PURE__ */ defineComponent({
   methods: {
     updateModelValueDisplay(newValue: any) {
       const fieldName = `${this.field.name}-display`;
-      if (Object.getOwnPropertyDescriptor(this.payload, fieldName)?.writable) {
+      if (this.payload[fieldName] === undefined || Object.getOwnPropertyDescriptor(this.payload, fieldName)?.writable) {
         this.payload[fieldName] = newValue;
       }
     },