-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add useSettings hook for reading multiple settings at once #55337
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
02d9b61
useSetting: optimize by not constructing path strings
jsnajdr d157e18
useSetting: handle the case where clientId is null
jsnajdr 501b039
getValueFromObjectPath: memoize splitting path into array, like lodas…
jsnajdr ffd13a2
useSetting: memoize results of PATHS_WITH_MERGE transforms
jsnajdr 5c88662
Add useSettings hook for batched setting retrieval
jsnajdr 09becfc
Rewrite usages of useSetting to useSettings
jsnajdr bf20388
Fix unit tests for useSetting, run hooks inside React render
jsnajdr 938b1ff
Fix docs plural/singular
jsnajdr 9740868
Refactor to vararg paths
jsnajdr 79e62a3
Group block: remove unused usedLayout variable
jsnajdr c994be1
Migrate all remaining usages of useSetting
jsnajdr 2205c38
Update docs
jsnajdr 0160429
Rename use-setting to use-settings
jsnajdr f8beb3e
Update unit tests
jsnajdr c8e020c
Add jsdoc for the mergeOrigins helper
jsnajdr 7e530bc
Fixup customFontSize variable name
jsnajdr 9ebf699
Deprecate useSetting for real
jsnajdr 8a312be
Unit test for deprecated useSetting
jsnajdr 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
Update docs
- Loading branch information
commit 2205c386d5d48a15ff5b38aaa4781d9cdaeab89a
There are no files selected for viewing
This file contains 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 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 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
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.
I'm a bit confused here because the PR description says
Can both be used? It would be nice to be consistent so we don't need to normalise.
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.
Only the
useSettings( 'a', 'b' )
form can be used. The PR originally started with an array argument,useSettings( settings: string[] )
, but then was changed touseSettings( ...settings: string[] )
during review. That's why the PR description is out of date.The main reason for that was that when reading a single setting,
useSetting( 'a' )
anduseSettings( 'a' )
are the same, except that foruseSettings
the return value is always an array (with one element).