dylang / shortid

Short id generator. Url-friendly. Non-predictable. Cluster-compatible.
https://www.npmjs.org/package/shortid
Other
5.74k stars 258 forks source link

shortid.generate(), broken! #125

Closed latifs closed 6 years ago

latifs commented 6 years ago

Hi guys,

I'm using shortid in my react app, specifically in a component that deals with generating "quotes" (as in prices).

I'm using shortid.generate() to create a unique id for the items in the quote. import shortid from 'shortid'; const item = { id: shortid.generate(), ...

Ever since the recent update though , this breaks the app and I get a: Uncaught TypeError: Cannot read property 'id' of undefined

Any Idea why? Thanks

ai commented 6 years ago

Hi. Can you show stack trace? The full error text?

Also I need your browser.

latifs commented 6 years ago

Hi @ai, I use Chrome Version 67.0.3396.99 (Official Build) (64-bit). but the same thing happen in Safari too.

And here is the message I get from chrome that prevents the page to load fully:

2cb37cf63063697274b0d94ad88c72992efe856b.js:27 Uncaught TypeError: Cannot read property 'id' of undefined at cluster-worker-id.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:27) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at AddToQuote.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:77) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at ProductDetail.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:73) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at index.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:73) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at routes.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at MainApp.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at main.js (2cb37cf63063697274b0d94ad88c72992efe856b.js:82) at fileEvaluate (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at require (2cb37cf63063697274b0d94ad88c72992efe856b.js:1) at 2cb37cf63063697274b0d94ad88c72992efe856b.js:82

Thanks for your help.

latifs commented 6 years ago

@ai, I tried right now in package.json to replace: "shortid": "^2.2.8" with "shortid": "2.2.8"

now the page loads and the error is gone, so probably something with shortid 2.2.11

ai commented 6 years ago

I will fix it after few hours.

latifs commented 6 years ago

@ai Thanks!

ai commented 6 years ago

Should be fixed in 2.2.12

(BTW, you have something bad without your JS bundle, you shouldn’t see this file)