Repository navigation
Block Editor: Include migration hint in useSetting deprecation warning #85100
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
Merged
Mamaduka
merged 4 commits into
WordPress:trunk
from
SainathPoojary:fix/block-editor-use-setting-hint
Oct 20, 2026
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6964b6e
Block Editor: Pass hint instead of note to deprecated in useSetting
SainathPoojary 6db6693
Block Editor: Add unit test for useSetting deprecation warning
SainathPoojary 1015c36
Block Editor: Add Changelog entry
SainathPoojary 3a146e4
Block Editor: Remove redundant deprecation warning test
SainathPoojary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/block-editor/src/components/use-settings/test/index.jsdom.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { renderHook } from '@testing-library/react'; | ||
| import { createRegistry, RegistryProvider } from '@wordpress/data'; | ||
| import { useSetting } from '../'; | ||
| import { store as blockEditorStore } from '../../../store'; | ||
|
|
||
| describe( 'useSetting', () => { | ||
| it( 'includes the migration hint in its deprecation warning', () => { | ||
| const registry = createRegistry(); | ||
| registry.register( blockEditorStore ); | ||
| registry.dispatch( blockEditorStore ).updateSettings( { | ||
| __experimentalFeatures: { | ||
| typography: { dropCap: false }, | ||
| }, | ||
| } ); | ||
|
|
||
| const { result } = renderHook( | ||
| () => useSetting( 'typography.dropCap' ), | ||
| { | ||
| wrapper: ( { children } ) => ( | ||
| <RegistryProvider value={ registry }> | ||
| { children } | ||
| </RegistryProvider> | ||
| ), | ||
| } | ||
| ); | ||
|
|
||
| expect( result.current ).toBe( false ); | ||
| expect( console ).toHaveWarnedWith( | ||
| 'wp.blockEditor.useSetting is deprecated since version 6.5. Please use wp.blockEditor.useSettings instead. Note: The new useSettings function can retrieve multiple settings at once, with better performance.' | ||
| ); | ||
| } ); | ||
| } ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing the
deprecatedmethod's internals. I don't think this test is needed.