mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Handle undefined user features in UserFeaturesProvider
GitOrigin-RevId: 70841809f691e9f20591bdf1ea05c510a44892af
This commit is contained in:
committed by
Copybot
parent
827fb19df7
commit
b8e391c005
@@ -19,7 +19,7 @@ export const UserFeaturesProvider: FC<React.PropsWithChildren> = ({
|
||||
}) => {
|
||||
const user = useUserContext()
|
||||
const { writefullInstance } = useEditorContext()
|
||||
const [features, setFeatures] = useState(user.features)
|
||||
const [features, setFeatures] = useState(user.features || {})
|
||||
|
||||
useReceiveUser(
|
||||
useCallback(data => {
|
||||
@@ -61,7 +61,7 @@ export function useUserFeaturesContext() {
|
||||
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
'useUserFeaturesContext is only available inside UserFeaturesContext, or `ol-user` meta is not defined'
|
||||
'useUserFeaturesContext is only available inside UserFeaturesContext'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user