[Persisted] Make broadcast subscriptions granular by key (#4874)
* Add fast path for guaranteed noop updates * Change persisted.onUpdate() API to take a key * Implement granular broadcast listeners
This commit is contained in:
@@ -43,8 +43,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
return persisted.onUpdate(() => {
|
||||
setState(persisted.get('languagePrefs'))
|
||||
return persisted.onUpdate('languagePrefs', nextLanguagePrefs => {
|
||||
setState(nextLanguagePrefs)
|
||||
})
|
||||
}, [setStateWrapped])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user