Ensure preferences object skips equality checks if overridden
This commit is contained in:
@@ -101,8 +101,7 @@ export function Provider({children}: {children: React.ReactNode}) {
|
|||||||
isReady: isFetched || !isAgeAssuranceEnabled,
|
isReady: isFetched || !isAgeAssuranceEnabled,
|
||||||
status,
|
status,
|
||||||
lastInitiatedAt,
|
lastInitiatedAt,
|
||||||
isAgeRestricted:
|
isAgeRestricted: isAgeAssuranceEnabled ? status !== 'assured' : false,
|
||||||
isFetched && isAgeAssuranceEnabled ? status !== 'assured' : false,
|
|
||||||
}
|
}
|
||||||
logger.debug(`context`, ctx)
|
logger.debug(`context`, ctx)
|
||||||
return ctx
|
return ctx
|
||||||
|
|||||||
@@ -77,9 +77,12 @@ export function usePreferencesQuery() {
|
|||||||
(data: UsePreferencesQueryResponse) => {
|
(data: UsePreferencesQueryResponse) => {
|
||||||
const isUnderage = (data.userAge || 0) < 18
|
const isUnderage = (data.userAge || 0) < 18
|
||||||
if (isUnderage || isAgeRestricted) {
|
if (isUnderage || isAgeRestricted) {
|
||||||
data.moderationPrefs = makeAgeRestrictedModerationPrefs(
|
data = {
|
||||||
|
...data,
|
||||||
|
moderationPrefs: makeAgeRestrictedModerationPrefs(
|
||||||
data.moderationPrefs,
|
data.moderationPrefs,
|
||||||
)
|
),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user