From 0cd462333e44f9106355024de2725d1a080103a4 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 20 Sep 2022 10:39:46 -0400 Subject: [PATCH] Change to record to avoid duplicate additional links during development --- .../netlify-cms-core/src/components/Collection/Sidebar.js | 2 +- packages/netlify-cms-core/src/lib/registry.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/netlify-cms-core/src/components/Collection/Sidebar.js b/packages/netlify-cms-core/src/components/Collection/Sidebar.js index fa046b0a..33113ac8 100644 --- a/packages/netlify-cms-core/src/components/Collection/Sidebar.js +++ b/packages/netlify-cms-core/src/components/Collection/Sidebar.js @@ -205,7 +205,7 @@ export class Sidebar extends React.Component { .toList() .filter(collection => collection.get('hide') !== true) .map(collection => this.renderLink(collection, filterTerm))} - {additionalLinks.map(this.renderAdditionalLink)} + {Object.values(additionalLinks).map(this.renderAdditionalLink)} ); diff --git a/packages/netlify-cms-core/src/lib/registry.js b/packages/netlify-cms-core/src/lib/registry.js index 114b0e96..dfe21807 100644 --- a/packages/netlify-cms-core/src/lib/registry.js +++ b/packages/netlify-cms-core/src/lib/registry.js @@ -26,7 +26,7 @@ const registry = { previewStyles: [], widgets: {}, icons: {}, - additionalLinks: [], + additionalLinks: {}, editorComponents: Map(), remarkPlugins: [], widgetValueSerializers: {}, @@ -304,8 +304,8 @@ export function getIcon(name) { /** * Icons */ -export function registerAdditionalLink(title, url, iconName) { - registry.additionalLinks.push({ title, url, iconName }); +export function registerAdditionalLink(id, title, url, iconName) { + registry.additionalLinks[id] = { title, url, iconName }; } export function getAdditionalLinks() { return registry.additionalLinks;