1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

fix unique keys

This commit is contained in:
Matthias Kretschmann 2019-11-06 12:43:33 +01:00
parent 3e40c3d078
commit dad281d32c
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 10 additions and 7 deletions

View File

@ -62,6 +62,7 @@
"remark": "^11.0.1",
"remark-github-plugin": "^1.3.1",
"remark-react": "^6.0.0",
"shortid": "^2.2.15",
"slugify": "^1.3.4",
"smoothscroll-polyfill": "^0.4.4",
"swagger-client": "^3.9.5"

View File

@ -1,6 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import slugify from 'slugify'
import shortid from 'shortid'
import Scroll from '../../components/Scroll'
import styles from './Entities.module.scss'
import { filterByKindOfProperty } from './utils'
@ -34,13 +35,13 @@ const Type = ({ type }) => {
<span className={styles.typeSymbol}>&lt;</span>
<span>
{typeArguments.map((typeArgument, i) => (
<span key={i}>
<span key={shortid.generate()}>
{i !== 0 && (
<span className={styles.typeSymbol}>
,{' '}
</span>
)}
<Type type={typeArgument} key={i} />
<Type type={typeArgument} />
</span>
))}
</span>
@ -88,7 +89,7 @@ const MethodDetails = ({ property }) => {
return (
<div
className={styles.parameters}
key={parameter.name}
key={shortid.generate()}
>
<h5>
<code>{name}</code>
@ -227,7 +228,7 @@ PropertyWrapper.propTypes = {
const Entities = ({ entities, sourceUrl }) =>
entities.map(({ name, comment, children }) => (
<div key={name} id={name && slugify(name)}>
<div key={shortid.generate()} id={name && slugify(name)}>
<h2 className={styles.entityName}>
<code>{name}</code>
</h2>
@ -243,7 +244,7 @@ const Entities = ({ entities, sourceUrl }) =>
.filter(filterByKindOfProperty)
.map(property => (
<PropertyWrapper
key={`${name}/${property.id}`}
key={shortid.generate()}
property={property}
sourceUrl={sourceUrl}
parentAnchor={name && slugify(name)}

View File

@ -1,6 +1,7 @@
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import slugify from 'slugify'
import shortid from 'shortid'
import Scrollspy from 'react-scrollspy'
import Scroll from '../../components/Scroll'
import { filterByKindOfProperty } from './utils'
@ -19,7 +20,7 @@ export default class Toc extends PureComponent {
)[0] // Assuming deprecated annotation
return (
<li key={name}>
<li key={shortid.generate()}>
<Scroll
type="id"
element={`${parentName}-${name && slugify(name)}`}
@ -44,7 +45,7 @@ export default class Toc extends PureComponent {
)
return (
<li key={name}>
<li key={shortid.generate()}>
<Scroll
type="id"
element={`${name && slugify(name)}`}