diff --git a/packages/app-project/src/shared/components/CollectionsModal/components/SelectCollection/SelectCollection.js b/packages/app-project/src/shared/components/CollectionsModal/components/SelectCollection/SelectCollection.js index ea4e25348a..0a43ec4718 100644 --- a/packages/app-project/src/shared/components/CollectionsModal/components/SelectCollection/SelectCollection.js +++ b/packages/app-project/src/shared/components/CollectionsModal/components/SelectCollection/SelectCollection.js @@ -47,6 +47,21 @@ function SelectCollection ({ return displayNameLowerCase.includes(searchText.toLowerCase()) } + /* + Determines the display label for the specific collection. + Returns "Example Collection" if that collection belongs to the current user, + otherwise returns "Example Collection (Another User's Name)" + + NOTE: sometime between Grommet > 2.41.0 and <= 2.45.1, the behaviour of + initially renders and _nothing_ is + selected, labelKey is called with an empty object {} argument. Prior to this + change, collectionLabel() was only called when there's a valid collection + object to render. (e.g. when clicking on Select to display list of options.) + + As a result, collectionLabel() now handles "no selection" (collection === {}) + without crashing, returning a meaningless "undefined (undefined)". The +