patch-package icon indicating copy to clipboard operation
patch-package copied to clipboard

Failed to apply patch

Open kosiew opened this issue 2 years ago • 1 comments

We found this in our Render deploy log:

Apr 13 04:29:54 PM  $ patch-package
Apr 13 04:29:55 PM  patch-package 6.5.1
Apr 13 04:29:55 PM  Applying patches...
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM  **ERROR** Failed to apply patch for package @wordpress/block-library at path
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM      node_modules/@wordpress/block-library
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM    This error was caused because patch-package cannot apply the following patch file:
Apr 13 04:29:55 PM  
Apr 13 04:29:55 PM      patches/@wordpress+block-library+8.5.0.patch

Here is the contents of the patches/@wordpress+block-library+8.5.0.patch

diff --git a/node_modules/@wordpress/block-library/build-module/heading/edit.js b/node_modules/@wordpress/block-library/build-module/heading/edit.js
index b748690..2370a7a 100644
--- a/node_modules/@wordpress/block-library/build-module/heading/edit.js
+++ b/node_modules/@wordpress/block-library/build-module/heading/edit.js
@@ -115,14 +115,12 @@ function HeadingEdit(_ref) {
     onSplit: (value, isOriginal) => {
       let block;
 
-      if (isOriginal || value) {
+      if (isOriginal) {
         block = createBlock('core/heading', { ...attributes,
           content: value
         });
       } else {
-        var _getDefaultBlockName;
-
-        block = createBlock((_getDefaultBlockName = getDefaultBlockName()) !== null && _getDefaultBlockName !== void 0 ? _getDefaultBlockName : 'core/heading');
+        block = createBlock('core/paragraph', {...attributes, content:value});
       }
 
       if (isOriginal) {
diff --git a/node_modules/@wordpress/block-library/build-module/quote/edit.js b/node_modules/@wordpress/block-library/build-module/quote/edit.js
index f108e09..0d4f038 100644
--- a/node_modules/@wordpress/block-library/build-module/quote/edit.js
+++ b/node_modules/@wordpress/block-library/build-module/quote/edit.js
@@ -89,6 +89,8 @@ export default function QuoteEdit(_ref) {
   });
   const innerBlocksProps = useInnerBlocksProps(blockProps, {
     template: TEMPLATE,
+    allowedBlocks: 
+      ['core/paragraph'],
     templateInsertUpdatesSelection: true
   });
   return createElement(Fragment, null, createElement(BlockControls, {

Strangely, it worked when we tested it locally after removing node_modules.

kosiew avatar Apr 13 '23 08:04 kosiew

I am experiencing the same problem.

Vitomir2 avatar May 28 '24 08:05 Vitomir2