Skip to content

Commit 334103e

Browse files
authored
Merge pull request #130 from workfloworchestrator/use-context-fix
Use context fix
2 parents 923b98b + 8112444 commit 334103e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': patch
3+
---
4+
5+
Improves context check in hook to avoid false negatives

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)