Skip to content

Commit

Permalink
use uniqid library to generate unique keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyubinhan committed May 25, 2018
1 parent 4503a29 commit 3b61aab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"dependencies": {
"axios": "^0.17.1",
"classnames": "^2.2.5",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"jspdf": "^1.3.5",
"jwt-decode": "^2.2.0",
"lodash.debounce": "^4.0.8",
Expand All @@ -24,8 +26,7 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"semantic-ui-react": "^0.78.2",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1"
"uniqid": "^4.1.1"
},
"devDependencies": {
"@types/jest": "^22.2.2",
Expand Down
3 changes: 2 additions & 1 deletion src/components/rangeUsePlan/edit/EditRupSchedule.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import uniqid from 'uniqid';
import { Table, Button, Icon, TextArea, Form, Dropdown } from 'semantic-ui-react';
import { calcCrownTotalAUMs, roundTo1Decimal } from '../../../handlers';
import {
Expand Down Expand Up @@ -129,7 +130,7 @@ class EditRupSchedule extends Component {
});

return grazingScheduleEntries.map((entry, entryIndex) => {
const key = `schedule${scheduleIndex}entry${entryIndex}${new Date()}`;
const key = uniqid(`schedule${scheduleIndex}entry${entryIndex}`);
return (
<EditRupScheduleEntry
key={key}
Expand Down
3 changes: 2 additions & 1 deletion src/components/rangeUsePlan/edit/EditRupSchedules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import uniqid from 'uniqid';
import { Dropdown } from 'semantic-ui-react';
import { NOT_PROVIDED } from '../../../constants/strings';
import EditRupSchedule from './EditRupSchedule';
Expand Down Expand Up @@ -161,7 +162,7 @@ class EditRupSchedules extends Component {
isDeletingScheduleEntry,
} = this.props;
const { yearOptions, activeScheduleIndex } = this.state;
const key = `schedule${schedule.year}${new Date()}`;
const key = uniqid(`schedule${scheduleIndex}`);

return (
<EditRupSchedule
Expand Down

0 comments on commit 3b61aab

Please sign in to comment.