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

TypeError: Class constructor CustomEvent cannot be invoked without 'new' #77

Closed
cohancarpentier opened this issue Apr 21, 2021 · 25 comments

Comments

@cohancarpentier
Copy link

cohancarpentier commented Apr 21, 2021

When running tests with Jest & running our app on "@rehooks/local-storage": "2.4.1"

Details:

     at new LocalStorageChanged (node_modules/@rehooks/local-storage/src/local-storage-events.ts:21:9)
      at Object.writeStorage (node_modules/@rehooks/local-storage/src/local-storage-events.ts:54:30)
      at create (node_modules/@rehooks/local-storage/src/use-localstorage.ts:89:7)
      at apply (node_modules/react-dom/cjs/react-dom.development.js:23487:20)
      at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:3945:14)
      at innerInvokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:315:27)
      at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:266:3)
      at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:212:11)
      at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
      at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)

image

@AndreasGJ
Copy link

I have the same error?

zburke added a commit to folio-org/platform-complete that referenced this issue Apr 22, 2021
Modules that use `PersistedPaneset` are broken due to bugs in the
release of `@rehooks/local-storage` `2.4.1`. Additional details at
rehooks/local-storage#77

Refs FOLIO-3128
zburke added a commit to folio-org/stripes-smart-components that referenced this issue Apr 23, 2021
zburke added a commit to folio-org/stripes-smart-components that referenced this issue Apr 23, 2021
zburke added a commit to folio-org/stripes-smart-components that referenced this issue Apr 23, 2021
@spencerschack
Copy link

I am having the same issue. For a quickfix you can rollback to 2.4.0. The breaking behavior was introduced by #67. I think the fix would be to implement the suggestion in this comment: #67 (comment)

@AndreasGJ
Copy link

@spencerschack you are a life saver 🥇

@ckknight
Copy link

ckknight commented May 4, 2021

Yep, running into this. Reverting to 2.4.0 works.

@se7entyse7en
Copy link

I can confirm that our CI started failing when we updated from 2.4.0 to 2.4.1.

@faradaytrs
Copy link

When is that planned to be fixed? 2.4.1 is broken

@amed
Copy link

amed commented Jun 15, 2021

Any update on this?

@maapteh
Copy link

maapteh commented Jun 18, 2021

@jharrilim is it possible to make at least a working patch version? Everytime when doing a interactive upgrade this lib pops up in not making our build correctly anymore. Its not expectable that using a patch upgrade can give this behaviour. Thanks!

@jharrilim
Copy link
Collaborator

I am having the same issue. For a quickfix you can rollback to 2.4.0. The breaking behavior was introduced by #67. I think the fix would be to implement the suggestion in this comment: #67 (comment)

Thanks for suggesting the quickfix!

Any update on this?

I haven't taken a look at this repo in a while so I might be a bit slow to boot, but I shall look into this tonight or sometime this week.

@jharrilim is it possible to make at least a working patch version? Everytime when doing a interactive upgrade this lib pops up in not making our build correctly anymore. Its not expectable that using a patch upgrade can give this behaviour. Thanks!

Agreed, and sorry for the inconvenience. We shall fix this sometime soon.

@jharrilim
Copy link
Collaborator

jharrilim commented Jul 25, 2021

While I wait on getting access to publish to npmjs.com, I have published the 2.4.2 patch to GitHub packages instead, and have also published it under my own scope. Here is how you may use both alternatives:

Switch to @jharrilim/local-storage

Probably the simplest choice, just change your package.json entry that once said:

{
  "dependencies": {
    "@rehooks/local-storage": "^2.4.1"
  }
}

to:

{
  "dependencies": {
    "@jharrilim/local-storage": "^2.4.2"
  }
}

Use the GitHub package

A little more effort, but if it matters, it keeps you pulling from the same org. Add a .npmrc file to your repo if you don't already have one, and ensure it has this line in it:

@rehooks:registry=https://npm.pkg.github.com

@davidcostadev
Copy link

Do we have some plans to update the version on the npm?
image

Raymans added a commit to Raymans/gh-web that referenced this issue Aug 20, 2021
…, comment out x-user-key for templateInterviews, implements select template behavior and support copy interview by id,
@jharrilim
Copy link
Collaborator

Do we have some plans to update the version on the npm?
image

Sorry to say it but it doesn't look like I'll be able to do this any time soon:
#78 (comment)
#61 (comment)

As mentioned above, however, I have provided 2 viable solutions that were the best I could do for now. Feel free to use those, or fork this repo if those solutions aren't preferable.

@iamsolankiamit
Copy link
Member

@jharrilim the fix is released under 2.4.3 version on npm. I don't have org access to rehooks to add you as a contributor to npm. Didn't focus on this, as I was busy with my day job and don't really use this package anymore. Thanks for keeping it maintained. I'll try to be more active with publishing.

@anark
Copy link

anark commented Sep 7, 2021

I am still seeing this error after upgrading to 2.4.3. Is there anything else that needs to be done to fix this?
Screen Shot 2021-09-07 at 9 17 14 AM

@samofwise
Copy link

Hey Im also seeing this error on version 2.4.3. Any update on a fix?

@faradaytrs
Copy link

faradaytrs commented Sep 8, 2021

@samofwise Same here, problem wasn't fixed in 2.4.3, please reopen @iamsolankiamit

@iamsolankiamit
Copy link
Member

Reopening as it seems the issue is not resolved

@iamsolankiamit iamsolankiamit reopened this Sep 8, 2021
@quolpr
Copy link

quolpr commented Sep 16, 2021

Yep, an issue is still here

@ayozemr
Copy link

ayozemr commented Sep 19, 2021

same here, reverting to 2.4.0 works

@mrjackyliang
Copy link

installing 2.4.0 works

@j05u3
Copy link

j05u3 commented Oct 12, 2021

@jharrilim the fix is released under 2.4.3 version on npm. I don't have org access to rehooks to add you as a contributor to npm. Didn't focus on this, as I was busy with my day job and don't really use this package anymore. Thanks for keeping it maintained. I'll try to be more active with publishing.

Thanks!
Btw, out of curiosity, do you use another package or another way to handle reactive local storage? or you just meant you don't code this kind of features anymore.

@MichaelBakker1986
Copy link

2.4.3 Still same error

 41 |  * on a large library such as Redux.
  42 |  */
  43 | var LocalStorageChanged = /** @class */ (function (_super) {
> 44 |     __extends(LocalStorageChanged, _super);
  45 |     function LocalStorageChanged(payload) {
  46 |         return _super.call(this, LocalStorageChanged.eventName, { detail: payload }) || this;
  47 |     }

@formatlos
Copy link

I do get the same error with 2.4.3, reverting back to 2.4.0 works

johangirod added a commit to betagouv/mon-entreprise that referenced this issue Nov 25, 2021
johangirod added a commit to betagouv/mon-entreprise that referenced this issue Nov 25, 2021
@giladgo
Copy link

giladgo commented Dec 5, 2021

Will #80 fix this? Seems that inheriting from CustomEvent was removed there...
I was just wondering... when can we expect the next release to npm? :)

@iamsolankiamit
Copy link
Member

@giladgo 2.4.4 should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests