Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation block view script JS console error #36506

Closed
sabernhardt opened this issue Nov 16, 2021 · 7 comments
Closed

Navigation block view script JS console error #36506

sabernhardt opened this issue Nov 16, 2021 · 7 comments
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended

Comments

@sabernhardt
Copy link
Contributor

Description

In WordPress 5.9 trunk, with Twenty Twenty-Two theme, the navigation block view script does not use the correct URL.

This may be related to returning false on the $is_core_block check in blocks.php.

Step-by-step reproduction instructions

  1. Update to the latest WordPress trunk.
  2. (Install and) activate the Twenty Twenty-Two theme.
  3. View the site (front end).
  4. Open the browser console to view errors, or else view source and search for the wp-block-navigation-view-js script.

Screenshots, screen recording, code snippet

navigation block view script error

Environment info

  • WordPress 5.9 trunk (r52178), without Gutenberg plugin
  • Firefox 94, Chrome 95
  • Desktop with Windows 10

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

@Mamaduka Mamaduka added [Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 16, 2021
@mkaz
Copy link
Member

mkaz commented Nov 16, 2021

🤔 I can not duplicate, I'm not sure if it is environment or with WP.

I checked out trunk from: https://github.com/WordPress/wordpress

Running latest without plugin, and it includes this JS file:

<script type='text/javascript' src='http://localhost:8003/wp-includes/blocks/navigation/view.min.js?ver=4942262e50480536aae4cd504a13f19c' id='wp-block-navigation-view-js'></script>

The link you have to blocks.php does seem like the right spot, because looking at the path it is trying to pull in your error, it is the full file system path, so it is not doing the replacement part.

It looks like it determines if it is a core block if the block.json metadata file starts is located within the WP_INC directory, which should be the case, which makes me think it is a Windows path issue of some sort. I'm trying to test on Local now.

@mkaz
Copy link
Member

mkaz commented Nov 17, 2021

ok, I can duplicate this now using Local on Windows. I'll see if I can dig into more why.

@chthonic-ds
Copy link
Contributor

I'm not sure if the diagnosis in #33273 (comment) is correct, but there was a similar script path issue in earlier releases of Gutenberg, too.

@mkaz
Copy link
Member

mkaz commented Nov 17, 2021

Good find @chthonic-ds thank you, that is the same issue. Working on a fix now.

I just confirmed in my test environment that:

ABSPATH . WPINC => C:/Users/marcu/Local Sites/wpbeta/app/public/wp-includes

and

$metadata['file'] => C:\Users\marcu\Local Sites\wpbeta\app\public\wp-includes\blocks/navigation/block.json

So the conditional check fails.

@mkaz
Copy link
Member

mkaz commented Nov 17, 2021

I can't find the code in Gutenberg plugin, I'm not quite sure how it was migrated.
I created a ticket and patch with a fix on Trac at: https://core.trac.wordpress.org/ticket/54456

@carolinan
Copy link
Contributor

The patch in the trac ticket is merged, can this be closed?

@sabernhardt
Copy link
Contributor Author

The Trac change works for me.

@tellthemachines tellthemachines removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants