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 erroneously requests /wp/v2/block-navigation-areas in WP 5.9 #37138

Closed
noisysocks opened this issue Dec 6, 2021 · 2 comments · Fixed by #37187
Closed

Navigation block erroneously requests /wp/v2/block-navigation-areas in WP 5.9 #37138

noisysocks opened this issue Dec 6, 2021 · 2 comments · Fixed by #37187
Labels
[Block] Navigation Affects the Navigation Block REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@noisysocks
Copy link
Member

Description

The Navigation block is making a request to /wp/v2/block-navigation-areas.

const [ areaMenu, setAreaMenu ] = useEntityProp(
'root',
'navigationArea',
'navigation',
navigationArea
);

This won't work when the block is used in WP 5.9 without the Gutenberg plugin active as that REST API endpoint does not exist.

Step-by-step reproduction instructions

  1. Run the latest WP 5.9 trunk with no Gutenberg plugin active.
  2. Open the site editor.
  3. Insert a Navigation block if there isn't already one on the page.
  4. Open DevTools and look in the console.
  5. You'll see a 404 error from a request to /wp/v2/block-navigation-areas.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

@noisysocks noisysocks added [Type] Bug An existing feature does not function as intended REST API Interaction Related to REST API [Block] Navigation Affects the Navigation Block labels Dec 6, 2021
@talldan
Copy link
Contributor

talldan commented Dec 6, 2021

Could be tricky to solve. I think the original intent was to keep nav areas in the Gutenberg plugin until the deprecation period ends (not sure when that is and it might have already passed).

@noisysocks
Copy link
Member Author

If it hasn't already passed then we could wrap the relevant bits of JavaScript with an if ( process.env.GUTENBERG_PHASE === 2 ).

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 REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants