fix(client): fix error thrown when no block context (#6696)

This commit is contained in:
Junyi 2025-04-17 20:26:49 +08:00 committed by GitHub
parent b04e877d31
commit e9560bb42c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,7 +151,7 @@ export const AssignedFieldInner = (props: AssignedFieldProps) => {
export const AssignedField = (props) => {
const { form } = useFormBlockContext();
const { name } = useBlockContext();
const { name } = useBlockContext() || {};
return (
<BlockContext.Provider value={{ name: form ? 'form' : name }}>
<AssignedFieldInner {...props} />