ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.26k stars 287 forks source link

Failing build using patch package with deployment on Vercel and package react-contexify #429

Open eastcoasting opened 1 year ago

eastcoasting commented 1 year ago

Have removed node modules and tried to reset using npx patch-package react-contexify and npm i with script "postinstall": "prisma generate && patch-package", with the issue persisting.

ERROR Failed to apply patch for package react-contexify at path

node_modules/react-contexify

This error was caused because patch-package cannot apply the following patch file: patches/react-contexify+5.0.0.patch

index 5a371f7..93bb0f7 100644
--- a/node_modules/react-contexify/dist/react-contexify.esm.js
+++ b/node_modules/react-contexify/dist/react-contexify.esm.js
@@ -1,4 +1,5 @@
 import React, { useContext, createContext, useRef, useEffect, Children, cloneElement, useReducer, useState } from 'react';
+import ReactDOM from 'react-dom';
 import cx from 'clsx';

 function _extends() {
@@ -520,13 +521,16 @@ var Menu = function Menu(_ref) {
   }

   function handleAnimationEnd() {
-    if (state.willLeave && state.visible) {
-      setState({
-        visible: false,
-        willLeave: false
-      });
-    }
-  }
+    ReactDOM.flushSync(() => {
+      if (state.willLeave && state.visible) {
+        setState({
+                  visible: false,
+                  willLeave: false
+                });
+              }
+            })
+        }
+
orta commented 1 year ago

Unsure, maybe there's a difference in the underlaying version between your patch and the one that's now installed?