Skip to content

Commit 58411b1

Browse files
author
Ruben van Leeuwen
committed
Improves null check in context hook
1 parent 923b98b commit 58411b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/packages/pydantic-forms/src/core/hooks/usePydanticFormContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { PydanticFormContext } from '@/core/PydanticFormContextProvider';
55
export function usePydanticFormContext() {
66
const context = useContext(PydanticFormContext);
77

8-
if (!context) {
8+
if (context === null || context === undefined) {
99
throw new Error(
1010
'usePydanticFormContext must be used within a PydanticFormProvider',
1111
);

0 commit comments

Comments
 (0)