WordPress/gutenberg

Property 'structuredClone' doesn't exist in React Native demo

Closed this issue · 1 comments

Description

While building the React Native Editor project locally I get the following error in runtime: Property 'structuredClone' doesn't exist.

I traced back the error to #67707 where the idiom JSON.parse(JSON.stringify(...)) is replaced by structuredClone but that API is not available in Hermes (facebook/hermes#684).

Step-by-step reproduction instructions

Follow the steps described in the documentation to build and install the React Native Editor demo app: https://developer.wordpress.org/block-editor/contributors/code/react-native/

The app builds perfectly but when it runs, it fails with the described error.

Expected behaviour

The app works with no errors.

Actual behaviour

The following error is displayed on the screen:

 ERROR  ReferenceError: Property 'structuredClone' doesn't exist

This error is located at:
    in Editor (at with-dispatch/index.js:100)
    in WithDispatch(Editor) (at with-select/index.js:60)
    in Unknown (at pure/index.tsx:43)
    in WithSelect(WithDispatch(Editor)) (at src/index.native.js:40)
    in Gutenberg
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in gutenberg(RootComponent), js engine: hermes

WordPress information

  • WordPress version: Not installed
  • Gutenberg version: 5c8cda1
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: iPhone 16
  • Operating system: iOS 18.0
  • WordPress app version: None

Thanks for catching this, @Serchinastico!