Title: Bug: TypeError: d is not a constructor
Last modified: August 17, 2026

---

# Bug: TypeError: d is not a constructor

 *  [masakingston](https://wordpress.org/support/users/masakingston/)
 * (@masakingston)
 * [2 weeks, 4 days ago](https://wordpress.org/support/topic/bug-typeerror-d-is-not-a-constructor/)
 * Hello,
 * Thank you for maintaining Widget Options. I would like to report a compatibility
   bug with the Gutenberg Page & Post Block Options module, and request a fix.
 * **Environment**
    - Widget Options version: 4.2.5
    - WordPress: 7.0.4
    - Gutenberg / Block Editor (core)
 * **What happens**
 * When **Gutenberg Page & Post Block Options** is enabled:
    1. Open the block editor on a page/post.
    2. Insert or open a custom block whose registered `edit` component is wrapped with`
       React.memo` (or another non-callable React element type such as `forwardRef`/`
       lazy`).
    3. The block fails to mount and shows:
       “This block has encountered an error and
       cannot be previewed.”
    4. Browser console error (minified variable name may differ):
       `TypeError: d is 
       not a constructor`at the filter registered on `blocks.registerBlockType` in`
       includes/widgets/gutenberg/build/index.js`(namespace: `extended-widget-options/
       sidebar-component`), inside the `try` / `catch` that ends with `return new d(
       e)`.
 * Core blocks such as Paragraph work normally.
   The issue only appears for blocks
   whose registered `edit` is not a plain function/class (for example, `memo`-wrapped
   components).
 * Disabling **Gutenberg Page & Post Block Options** resolves the error immediately.
 * **Root cause**
 * In `includes/widgets/gutenberg/build/index.js`, the plugin adds a `blocks.registerBlockType`
   filter that wraps every block’s `edit` roughly like this:
 *     ```wp-block-code
       const d = settings.edit;settings.edit = function ( props ) {  // ... initialize extended_widget_opts_* attributes ...  try {    return d( props ); // call as a function  } catch ( err ) {    return new d( props ); // fallback: treat as a class constructor  }};
       ```
   
 * This is not how React components should be rendered.
    - Gutenberg normally renders `edit` via `wp.element.createElement( OriginalEdit,
      props )`.
    - Calling `OriginalEdit(props)` only works for plain function components.
    - `new OriginalEdit(props)` only works for class components.
    - Components created with `React.memo()`, `forwardRef()`, `lazy()`, etc. are
      objects, not callable functions and not constructors. For those:
       * `d(props)` throws (e.g. “is not a function”)
       * `new d(props)` throws `TypeError: d is not a constructor` ← the error we
         see
 * That is why core blocks (plain function `edit`) still work, while many modern
   third-party blocks break.
 * This is independent of any specific Lazy Edit / code-splitting feature in other
   plugins: any block that registers a memoized `edit` is affected.
 * **Requested fix**
 * Please change the wrapper so it always renders the original `edit` with `createElement`(
   or equivalent), for example:
 *     ```wp-block-code
       const OriginalEdit = settings.edit;settings.edit = function ( props ) {  // … your attribute initialization …  return wp.element.createElement( OriginalEdit, props );};
       ```
   
 * There is no need for the `try { OriginalEdit(props) } catch { new OriginalEdit(
   props) }` pattern.
 * **Expected result**
 * With Gutenberg Page & Post Block Options enabled, third-party blocks that use`
   React.memo` (and similar) for `edit` should mount normally, the same as core 
   blocks.
 * I would appreciate it if you could confirm and ship a fix in an upcoming release.
   Happy to provide more details or test a patch if helpful.
 * Thank you.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Mej de Castro](https://wordpress.org/support/users/mej/)
 * (@mej)
 * [2 weeks, 4 days ago](https://wordpress.org/support/topic/bug-typeerror-d-is-not-a-constructor/#post-18995099)
 * Hi [@masakingston](https://wordpress.org/support/users/masakingston/),
 * Thanks for reporting the issue and for taking the time to suggest a possible 
   fix.
 * We truly appreciate the information you’ve provided. We’ll relay your findings
   and suggested solution to our development team for review.
 * We’ll get back to you once we have more information from our dev team.
 * Thanks again for your help and patience!
 * Kind Regards,
   Mej, Widget Options Team

Viewing 1 replies (of 1 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-typeerror-d-is-not-a-constructor%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/widget-options/assets/icon-256x256.gif?rev=2513739)
 * [Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets](https://wordpress.org/plugins/widget-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-options/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-options/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Mej de Castro](https://wordpress.org/support/users/mej/)
 * Last activity: [2 weeks, 4 days ago](https://wordpress.org/support/topic/bug-typeerror-d-is-not-a-constructor/#post-18995099)
 * Status: not resolved