Skip to content

Commit

Permalink
COMPASS-134: Backport: Use uuids for document list keys (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran authored and imlucas committed Nov 11, 2016
1 parent 41d2305 commit 495cd45
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/internal-packages/crud/lib/component/document-list.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const _ = require('lodash');
const React = require('react');
const uuid = require('node-uuid');
const app = require('ampersand-app');
const Action = require('hadron-action');
const ObjectID = require('bson').ObjectID;
Expand Down Expand Up @@ -191,12 +192,10 @@ class DocumentList extends React.Component {
/**
* Get the key for a doc.
*
* @param {Document} doc - The document.
*
* @returns {String} The unique key.
*/
_key(doc) {
return `${NamespaceStore.ns}_${JSON.stringify(doc._id)}`;
_key() {
return uuid.v4();
}

/**
Expand All @@ -222,7 +221,7 @@ class DocumentList extends React.Component {
renderDocuments(docs) {
return _.map(docs, (doc) => {
return (
<li className="document-list-item" key={this._key(doc)}>
<li className="document-list-item" key={this._key()}>
<Document doc={doc} key={this._key(doc)} editable />
</li>
);
Expand Down

0 comments on commit 495cd45

Please sign in to comment.