question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

List with 'action' property generates a warning

See original GitHub issue

Expected Behavior

      <List
        primaryKey="name"
        data={[
          { name: 'Alan', percent: 20 },
          { name: 'Bryan', percent: 30 },
          { name: 'Chris', percent: 40 },
          { name: 'Eric', percent: 80 },
        ]}
        action={d => <Menu icon={<More />} hoverIndicator items={[{ label: "one" }]} />}
      />

No warning should be emitted.

Actual Behavior

There’s a warning:

index.js:1 Warning: Each child in a list should have a unique “key” prop.

Check the render method of InfiniteScroll. See https://fb.me/react-warning-keys for more information. in Box (created by InfiniteScroll) in InfiniteScroll (created by List) in ul (created by List__StyledList) in List__StyledList (created by List) in Keyboard (created by List) in List (created by List) in List (created by FocusableComponent) in FocusableComponent (created by List) in List (created by WithTheme(List)) in WithTheme(List) (at pages/index.js:7) in div (created by StyledGrommet) in StyledGrommet (created by Grommet) in Grommet (at pages/index.js:6) in Unknown (created by App) in App in Container (created by AppContainer) in AppContainer

If the ‘action’ property is removed, there is no warning.

Steps to Reproduce

See sandbox here: https://codesandbox.io/s/distracted-taussig-hdvjb

Your Environment

  • Grommet version: 2.11.2
  • Browser Name and version: Chrome v80
  • Operating System and version (desktop or mobile): Win10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
IanKBovardcommented, Mar 18, 2020

Changing action to this fixes the issue.

action={(d, index) => <Menu key={index} icon={<More />} hoverIndicator items={[{ label: "one" }]} />}

Menu needs a unique key prop because I’m assume list is mapping.

1reaction
IanKBovardcommented, Apr 6, 2020

My apologies, got caught up in a few projects. Giving this issue my full attention now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting the user's attention with alerts and action sheets
To display an alert or action sheet, create a UIAlertController object, configure it, and call its present(_:animated:completion:) method, as shown in the ...
Read more >
C# Compiler warning waves | Microsoft Learn
This warning is generated on all async entry point candidates when you have multiple valid entry points, including one or more synchronous entry ......
Read more >
List group - Bootstrap
List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any...
Read more >
Leverage user action and user session properties for web ...
User action and session properties, which are metadata key-value pairs, provide added visibility and deeper analysis of your end users' experience.
Read more >
Non-nullable property must contain a non-null value when ...
Empty; }. if you wish to retain the properties' types as non-null. ... With nullable enabled, it produces a lot of warnings.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found