Fluentui: Grouped DetailsList Uses Group Name as a key Instead of the Provided key

Created on 2 Nov 2018  路  3Comments  路  Source: microsoft/fluentui

Codepen Reproduction :
Codepen Link

Actual behavior:

Grouped List creates divs where it uses the name of the groups as keys. It throws duplicate key errors in the console ( it happens in the codepen provided too)

Expected behavior:

Grouped List should use the key provided to the group as the key

Priorities and help requested:

Are you willing to submit a PR to fix? (Yes, No): I don't know how to fix it yet

Requested priority: (Blocking, High, Normal, Low)

tagging @KevinTCoughlin

DetailsList Type

Most helpful comment

The source of the problematic key is _getPageSpecification() in GroupedList.base.tsx which only uses pageGroup.name to generate the key. A potential fix is to use pageGroup.key if present and only fall back to pageGroup.name if key is not present.

All 3 comments

The source of the problematic key is _getPageSpecification() in GroupedList.base.tsx which only uses pageGroup.name to generate the key. A potential fix is to use pageGroup.key if present and only fall back to pageGroup.name if key is not present.

The source of the problematic key is _getPageSpecification() in GroupedList.base.tsx which only uses pageGroup.name to generate the key. A potential fix is to use pageGroup.key if present and only fall back to pageGroup.name if key is not present.

Thanks @JasonGore, made implementing the fix super easy 馃憤. Adding unit tests now and will PR.

return {
  key: pageGroup && (pageGroup.key || pageGroup.name)
};

Actually, since IGroup.key is required and meant for providing a unique key whereas name is not I _may_ opt to not default here.

return {
  key: pageGroup && pageGroup.key
};

:tada:This issue was addressed in #6979, which has now been successfully released as [email protected].:tada:

Handy Links:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nekoya picture nekoya  路  3Comments

VincentBailly picture VincentBailly  路  3Comments

nekoya picture nekoya  路  3Comments

luisrudge picture luisrudge  路  3Comments

rickyp-ms picture rickyp-ms  路  3Comments