diff --git a/openlibrary/components/MergeUI/AuthorRoleTable.vue b/openlibrary/components/MergeUI/AuthorRoleTable.vue
index b109df1df78..b414a9aa0d6 100644
--- a/openlibrary/components/MergeUI/AuthorRoleTable.vue
+++ b/openlibrary/components/MergeUI/AuthorRoleTable.vue
@@ -19,7 +19,7 @@
{{role[field].key.slice("/authors/".length)}}
-
{{a[k]}}
+ {{role[field]}}
diff --git a/openlibrary/components/MergeUI/MergeTable.vue b/openlibrary/components/MergeUI/MergeTable.vue
index 5148640e374..bed7fd87360 100644
--- a/openlibrary/components/MergeUI/MergeTable.vue
+++ b/openlibrary/components/MergeUI/MergeTable.vue
@@ -8,7 +8,7 @@
} A response to the request
+ */
+export async function get_author_names(works) {
+ const authorIds = _.uniq(works).flatMap(record =>
+ (record.authors || []).map(authorEntry => authorEntry.author.key)
+ )
+
+ if (!authorIds.length) return {};
+
+ const queryParams = new URLSearchParams({
+ q: `key:(${authorIds.join(' OR ')})`,
+ mode: 'everything',
+ fields: 'key,name',
+ })
+
+ const response = await fetch(`${CONFIGS.OL_BASE_SEARCH}/search/authors.json?${queryParams}`)
+
+ if (!response.ok) {
+ throw new Error('Failed to fetch author data');
+ }
+
+ const results = await response.json()
+
+ const authorDirectory = {}
+
+ for (const doc of results.docs) {
+ authorDirectory[doc.key] = doc.name;
+ }
+
+ return authorDirectory
+}
+
+
// /**
// * @param {Object} record
// * @param {string} comment