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

BlockContextProvider not working when used in 'editor.BlockEdit' hook with WordPress 6.3 #53869

Open
imnavanath opened this issue Aug 22, 2023 · 2 comments
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended

Comments

@imnavanath
Copy link

imnavanath commented Aug 22, 2023

Description

In WordPress 6.3 the <BlockContextProvider> stops working, whereas it was working previously in WordPress 6.2.2.
Here I tried to change the editor preview for dynamic query blocks, and get result as per default 'Hello World' post (instead of current active post). I've attached the snipett which I used.

Did something updated? Any alternative WordPress suggests?

Step-by-step reproduction instructions

  1. Open the block editor
  2. Use the following snipett to check it out the working
  3. Use Title, Featured Image block in the editor
  4. This dynamic query blocks now should point to 'Hello World' post data but in 6.3 now its pointing to current post only

Screenshots, screen recording, code snippet

Working fine with 6.2.2 - https://d.pr/i/t90Fvu (Post Title block showing title as per hello world post)
Breaking with 6.3 - https://d.pr/i/gZJR8J (Post title block pointing to current active post's title)
Code snipett I used-

addFilter(
	'editor.BlockEdit',
	'updateEditorQueryPreview',
	wp.compose.createHigherOrderComponent((C) => (props) => {
		const blockContext = { postType: 'post', postId: 1 };

		return (
			<BlockContextProvider value={blockContext}>
				<C {...props} />
			</BlockContextProvider>
		)
	})
);

Environment info

  • WordPress Version 6.3

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

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. labels Aug 23, 2023
@github-actions
Copy link

Hi,
This issue has gone 30 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.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Sep 23, 2023
@tellthemachines
Copy link
Contributor

Looks like this was caused by #52351; left a comment over there.

@tellthemachines tellthemachines removed Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants