Skip to content

BlockPreview not loading __unstableResolvedAssets #39699

Closed

Description

@franmastromarino

Description

Hello

The BlockPreview is not loading the block scripts declared in the __unstableResolvedAssets.scripts setting

Is working correctly in edit site and edit post iframes

`function test( $settings ) {

$settings['__unstableResolvedAssets']['scripts'] .= '<script id="test-script" src="./test.js"></script>';
$settings['__unstableResolvedAssets']['styles'] .= '<link href="./test.css" id="test-style" rel="stylesheet" media="all">';

return $settings;

}

if ( function_exists( 'get_block_editor_settings' ) ) {
add_filter( 'block_editor_settings_all', 'test', PHP_INT_MAX );
} else {
add_filter( 'block_editor_settings', 'test', PHP_INT_MAX );
}`

Step-by-step reproduction instructions

  1. Copy PHP code
  2. Past in the functions.php of theme
  3. Create <BlockPreview blocks={ blocks } viewportWidth={ 800 } />
  4. Check iframe head, all are included but not the

Screenshots, screen recording, code snippet

https://snipboard.io/xCLZwD.jpg

Environment info

WordPress version: 5.9.2
Gutenberg version: 12.7.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. franmastromarino commented on Mar 23, 2022

    @franmastromarino
    Author

    hello mate
    thanks for your feedback
    however this is not the same issue, this issue is related to the embed scripts in the BlockPreview

  2. franmastromarino commented on Apr 1, 2022

    @franmastromarino
    Author

    hi, any updates on this?

  3. added
    Needs Technical Feedback
    on Apr 4, 2022
  4. github-actions commented on Oct 1, 2022

    @github-actions

    Hi,
    This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
    Thanks for helping out.

  5. added
    Needs Testing
    on Oct 1, 2022
  6. Mamaduka commented on Oct 18, 2022

    @Mamaduka
    Member

    The issue still needs technical feedback. I am removing the "Needs Testing" label.

  7. removed
    Needs Testing
    on Oct 18, 2022
  8. ellatrix commented on Aug 17, 2023

    @ellatrix
    Member

    Hi! Please, you shouldn't override the __unstableResolvedAssets setting, it's meant for internal use only. These are the assets generated by the WP dependency resolver. Instead, please use the enqueue_block_assets hook, which will now also load assets in the iframe in WP 6.3 (#49655). Or use block.json. See https://make.wordpress.org/core/2023/07/18/miscellaneous-editor-changes-in-wordpress-6-3/#post-editor-iframed for more information. I will close this issue, feel free to reopen or create a new issues if you're having problems with enqueue_block_assets. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Technical Feedback

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions