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

backend.backend is not a constructor #484

Open
mikanyg opened this issue Oct 13, 2019 · 6 comments
Open

backend.backend is not a constructor #484

mikanyg opened this issue Oct 13, 2019 · 6 comments

Comments

@mikanyg
Copy link

mikanyg commented Oct 13, 2019

Just updated to version 1.3.2 of @angular-skyhook/multi-backend and 1.3.0 of @angular-skyhook/core and I am getting the following error:

ERROR TypeError: backend.backend is not a constructor
at MultiBackend.js:239
at Array.forEach ()
at new _default (MultiBackend.js:227)
at index.js:60
at angular-skyhook-multi-backend.js:45
at createDragDropManager (factories.js:4)
at angular-skyhook-core.js:1543
at ZoneDelegate.invoke (zone-evergreen.js:359)
at Zone.run (zone-evergreen.js:124)
at NgZone.runOutsideAngular (core.js:39571)

Did I miss some breaking change between 1.2.1 and 1.3.0/1.3.2 ?

@cormacrelf
Copy link
Owner

It’s a bit weird that the issue would only show up now, considering dnd-multi-backend has apparently always treated backends as constructors. The main backends are not actually constructors. Can you file or search for an issue on LouisBrunner/dnd-multi-backend ? Note that we’re still using 3.x as I couldn’t get 4.0 to work at all, so that’s another one.

https://github.com/react-dnd/react-dnd/blob/704245d47892f9d465b1b4465203f5c8464eb5a7/packages/core/html5-backend/src/index.ts#L7-12

@cormacrelf
Copy link
Owner

(Oh, I figured out that dnd-multi-backend 4.0 is a really breaking change, requiring using react-dnd-cjs and all the -cjs versions of all those packages. I won’t make my dependents do that (and then switch back), so no v4, only v5 which will fix this apparently.)

Upshot is we probably need a maintenance release on 3.x, or a workaround wrapper class to make every backend a constructor even when it’s not. I think 4.0 was mainly react-dnd-centric changes, which is why 3.x still works with dnd-core v9 if you partially apply your backends to pass options in. @LouisBrunner any chance of a 3.x fix?

@cormacrelf
Copy link
Owner

See the issue on dnd-multi-backend. Essentially, you can also work around this by transpiling to ES5 in all cases. Angular 8 I believe will try to deliver ES2015 to capable browsers, but if you turn that off (however that works), this will probably work again. I would probably just wait for another patch release that upgrades to dnd-multi-backend 5.0.0, which is now in alpha and will hopefully include my PR.

@LouisBrunner
Copy link

@cormacrelf 5.0.0-rc02 (and future v5) should address this. You mention a 3.x fix, do you mean the same fix applied on the v3 branch?

@cormacrelf
Copy link
Owner

Nah don’t worry about it if you’ve already got 5 off the ground

@mikanyg
Copy link
Author

mikanyg commented Jan 26, 2020

Any news on when the next release will be out?

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

No branches or pull requests

3 participants