| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1578,6 +1578,9 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { | |||
| 1578 | 1578 | } | |
| 1579 | 1579 | } | |
| 1580 | 1580 | ||
| 1581 | + // recordLabel should get raw foreign key values, not { label, pk } references added below | ||
| 1582 | + const rawItems = data.data.map((item) => ({ ...item })); | ||
| 1583 | + | ||
| 1581 | 1584 | // for foreign keys, add references | |
| 1582 | 1585 | await Promise.all( | |
| 1583 | 1586 | resource.columns.filter((col) => ( | |
@@ -1709,7 +1712,8 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { | |||
| 1709 | 1712 | adminforth: this.adminforth, | |
| 1710 | 1713 | }; | |
| 1711 | 1714 | ||
| 1712 | - for (const item of data.data) { | ||
| 1715 | + for (const [i, item] of data.data.entries()) { | ||
| 1716 | + const rawItem = rawItems[i]; | ||
| 1713 | 1717 | for (const key of Object.keys(item)) { | |
| 1714 | 1718 | if (key === '_primaryKeyValue') { | |
| 1715 | 1719 | continue; | |
@@ -1718,10 +1722,11 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI { | |||
| 1718 | 1722 | const bo = col ? await isBackendOnly(col, ctx) : true; | |
| 1719 | 1723 | if (!col || bo) { | |
| 1720 | 1724 | delete item[key]; | |
| 1725 | + delete rawItem[key]; | ||
| 1721 | 1726 | } | |
| 1722 | 1727 | } | |
| 1723 | 1728 | if (!selectedColumnNameSet || shouldAddListHelpers) { | |
| 1724 | - item._label = resource.recordLabel(item); | ||
| 1729 | + item._label = resource.recordLabel(rawItem); | ||
| 1725 | 1730 | } | |
| 1726 | 1731 | } | |
| 1727 | 1732 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments