-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Connect(Droppable): Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead. #2563
Comments
Same here. I don't know exactly what is causing this.
|
It's at least this line:
This kind of a patch helped to get rid of it in our project: diff --git a/dist/react-beautiful-dnd.esm.js b/dist/react-beautiful-dnd.esm.js
index ecced698aefb8b8e97a196195ef77955941e0b72..4753f5f9ba6c92969c6fa8bf81eb2fda389b4c72 100644
--- a/dist/react-beautiful-dnd.esm.js
+++ b/dist/react-beautiful-dnd.esm.js
@@ -8235,7 +8235,18 @@ function PublicDraggable(props) {
}));
}
-function Droppable(props) {
+function Droppable(passedProps) {
+ var defaultProps = {
+ mode: 'standard',
+ type: 'DEFAULT',
+ direction: 'vertical',
+ isDropDisabled: false,
+ isCombineEnabled: false,
+ ignoreContainerClipping: false,
+ renderClone: null,
+ getContainerForClone: getBody
+ };
+ var props = { ...defaultProps, ...passedProps };
var appContext = useContext(AppContext);
!appContext ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find app context') : invariant(false) : void 0;
var contextId = appContext.contextId,
@@ -8494,21 +8505,10 @@ function getBody() {
return document.body;
}
-var defaultProps = {
- mode: 'standard',
- type: 'DEFAULT',
- direction: 'vertical',
- isDropDisabled: false,
- isCombineEnabled: false,
- ignoreContainerClipping: false,
- renderClone: null,
- getContainerForClone: getBody
-};
var ConnectedDroppable = connect(makeMapStateToProps$1, mapDispatchToProps$1, null, {
context: StoreContext,
pure: true,
areStatePropsEqual: isStrictEqual
})(Droppable);
-ConnectedDroppable.defaultProps = defaultProps;
export { DragDropContext, PublicDraggable as Draggable, ConnectedDroppable as Droppable, resetServerContext, useKeyboardSensor, useMouseSensor, useTouchSensor }; |
@peruukki can you make it a PR please ? 🙏 |
I've understood this project is being sunsetted and replaced with Pragmatic drag and drop (see #2573), and no further development will be done apart from security fixes. The README says:
So it seems patching the package (via e.g. |
Hi, I have tried to change the file with the patch-package. Thanks for the suggestion. Uncaught ReferenceError: Droppable is not defined any thoughts what might be the case here? |
Could be some syntactic error with the changes, though the source line 7340 is surprising because One thing you could try is applying the changes with the standard
patch << 'EOF'
diff --git a/dist/react-beautiful-dnd.esm.js b/dist/react-beautiful-dnd.esm.js
index ecced698aefb8b8e97a196195ef77955941e0b72..4753f5f9ba6c92969c6fa8bf81eb2fda389b4c72 100644
--- a/dist/react-beautiful-dnd.esm.js
+++ b/dist/react-beautiful-dnd.esm.js
@@ -8235,7 +8235,18 @@ function PublicDraggable(props) {
}));
}
-function Droppable(props) {
+function Droppable(passedProps) {
+ var defaultProps = {
+ mode: 'standard',
+ type: 'DEFAULT',
+ direction: 'vertical',
+ isDropDisabled: false,
+ isCombineEnabled: false,
+ ignoreContainerClipping: false,
+ renderClone: null,
+ getContainerForClone: getBody
+ };
+ var props = { ...defaultProps, ...passedProps };
var appContext = useContext(AppContext);
!appContext ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not find app context') : invariant(false) : void 0;
var contextId = appContext.contextId,
@@ -8494,21 +8505,10 @@ function getBody() {
return document.body;
}
-var defaultProps = {
- mode: 'standard',
- type: 'DEFAULT',
- direction: 'vertical',
- isDropDisabled: false,
- isCombineEnabled: false,
- ignoreContainerClipping: false,
- renderClone: null,
- getContainerForClone: getBody
-};
var ConnectedDroppable = connect(makeMapStateToProps$1, mapDispatchToProps$1, null, {
context: StoreContext,
pure: true,
areStatePropsEqual: isStrictEqual
})(Droppable);
-ConnectedDroppable.defaultProps = defaultProps;
export { DragDropContext, PublicDraggable as Draggable, ConnectedDroppable as Droppable, resetServerContext, useKeyboardSensor, useMouseSensor, useTouchSensor };
EOF
|
I have this console error too in my nextjs app but everything is working properly: my version: "react-beautiful-dnd": "^13.1.1" part of my code, can someone help?
|
Migrate over to https://github.com/hello-pangea/dnd And try again See #2580 (comment) |
Connect(Droppable): Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.
any one have solution for this problem but remember don't suggest for { reactStrictMode: false }
The text was updated successfully, but these errors were encountered: