Make WordPress Core

#62796 closed defect (bug) (reported-upstream)

Block Inserter: directory search: infinity spinner if offline

Reported by: Drivingralle Owned by:
Priority: normal Milestone:
Component: Editor Version: 6.7.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

If a user is offline or in playground the network access is blocked the search section of the block inserter is showing the spinner infinity.

Inside the browser console the request (https://playground.wordpress.net/scope:calm-trendy-town/wp-json/wp/v2/block-directory/search?term=slider&_locale=user) very quickly returns a 500. But the UI never reflects to it.

Similar to the section above it I was expecting an error message if the search fails.

Attachments (1)

Bildschirmfoto 2025-01-09 um 13.59.28.jpg (611.5 KB ) - added by Drivingralle 19 months ago.

Download all attachments as: .zip

Change History (4)

#1 @sainathpoojary
19 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.8-alpha-59590
  • PHP: 8.2.27
  • Server: Apache/2.4.62 (Debian)
  • Database: mysqli (Server: 11.4.4-MariaDB-ubu2404 / Client: mysqlnd 8.2.27)
  • Browser: Chrome 131.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins: None

Actual Results

✅ Error condition occurs (reproduced).

Supplemental Artifacts

Video: https://utfs.io/f/PL8E4NiPUWyO7WG5Lz9AWOSNT8iuxYqzcvCVIEKbQmF3njPo

#2 @vrishabhsk
19 months ago

  • Keywords has-patch added

This is a fix that was to be made in Gutenberg for which I have raised a PR

https://github.com/WordPress/gutenberg/pull/68600

Attaching the patch here as well.

diff --git a/packages/block-directory/src/store/resolvers.js b/packages/block-directory/src/store/resolvers.js
index cd13ba5ccd..846ff9ef2b 100644
--- a/packages/block-directory/src/store/resolvers.js
+++ b/packages/block-directory/src/store/resolvers.js
@@ -35,5 +35,7 @@ export const getDownloadableBlocks =
 			);
 
 			dispatch( receiveDownloadableBlocks( blocks, filterValue ) );
-		} catch {}
+		} catch ( error ) {
+			dispatch( receiveDownloadableBlocks( [], filterValue ) );
+		}
 	};

#3 @Mamaduka
19 months ago

  • Milestone Awaiting Review
  • Resolutionreported-upstream
  • Status newclosed
Note: See TracTickets for help on using tickets.