Git Product home page Git Product logo

Comments (6)

peruukki avatar peruukki commented on May 27, 2024 1

It's at least this line:

ConnectedDroppable.defaultProps = defaultProps;

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 };

from react-beautiful-dnd.

marcoosvlopes avatar marcoosvlopes commented on May 27, 2024

Same here. I don't know exactly what is causing this.

Warning: Connect(Droppable): Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.

from react-beautiful-dnd.

g3r4n avatar g3r4n commented on May 27, 2024

@peruukki can you make it a PR please ? πŸ™

from react-beautiful-dnd.

peruukki avatar peruukki commented on May 27, 2024

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:

We recommend that you don’t raise issues or pull requests, as they will not be reviewed or actioned until further notice.

So it seems patching the package (via e.g. patch-package or yarn patch/pnpm patch) is the most convenient way to solve this.

from react-beautiful-dnd.

fmeert avatar fmeert commented on May 27, 2024

Hi, I have tried to change the file with the patch-package. Thanks for the suggestion.
However, I get this error now:

Uncaught ReferenceError: Droppable is not defined
at ./node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js (react-beautiful-dnd.esm.js:7340:1)

any thoughts what might be the case here?

from react-beautiful-dnd.

peruukki avatar peruukki commented on May 27, 2024

Hi, I have tried to change the file with the patch-package. Thanks for the suggestion. However, I get this error now:

Uncaught ReferenceError: Droppable is not defined at ./node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js (react-beautiful-dnd.esm.js:7340:1)

any thoughts what might be the case here?

Could be some syntactic error with the changes, though the source line 7340 is surprising because Droppable is only referenced at the almost end of the file where the line numbers go over 8000, but maybe you have something in your pipeline transforming it afterwards.

One thing you could try is applying the changes with the standard patch command if it's available in your system:

  1. Reset all changes you've made in react-beautiful-dnd
  2. Go to the installed package directory: cd node_modules/react-beautiful-dnd
  3. Apply the patch:
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
  1. Create the project patch file in the project directory, for example cd ../.. && npx patch-package react-beautiful-dnd

from react-beautiful-dnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.