Skip to content

Commit

Permalink
Assign key prop to html-overlay children that don't already have one …
Browse files Browse the repository at this point in the history
…specified (#348)
  • Loading branch information
dmaskasky committed Mar 11, 2020
1 parent 13cc857 commit a94e77d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/overlays/src/html-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ export default class HtmlOverlay<Props> extends Component<
const renderItems = [];
this.getItems()
.filter(Boolean)
.forEach(item => {
.forEach((item, index) => {
const [x, y] = this.getCoords(item.props.coordinates);
if (this.inView([x, y])) {
renderItems.push(cloneElement(item, { x, y }));
const key = item.key === null || item.key === undefined ? index : item.key;
renderItems.push(cloneElement(item, { x, y, key }));
}
});

Expand Down

0 comments on commit a94e77d

Please sign in to comment.