Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed random timestamp used for props.key #58

Merged
merged 3 commits into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"version": "2.0.4",
"description": "Typing animations with React",
"main": "dist/Typist.js",
"files": ["dist", "src"],
"files": [
"dist",
"src"
],
"scripts": {
"dist": "webpack --config webpack.dist.config.js",
"standalone": "webpack --config webpack.standalone.config.js",
Expand Down Expand Up @@ -61,7 +64,7 @@
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.7.0",
"mock-promises": "^0.6.1",
"node-sass": "^3.4.2",
"node-sass": "^4.9.3",
"postcss-loader": "^0.8.2",
"promise-mock": "^1.1.0",
"react": "^16.0.0",
Expand Down
4 changes: 3 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ export function extractTextFromElement(element) {
export function cloneElement(element, children) {
const tag = element.type;
const props = exclude(element.props, ['children']);
const getMilliseconds = new Date().getUTCMilliseconds();
const randomStamp = getMilliseconds + Math.random() + Math.random();
// eslint-disable-next-line
props.key = `Typist-element-${tag}-${Date.now() + Math.random() + Math.random()}`;
props.key = `Typist-element-${tag}-${randomStamp}`;
return React.createElement(tag, props, ...children);
}

Expand Down
Loading