Skip to content

Commit 9ed5cca

Browse files
authoredFeb 29, 2024
fix(core): check if previous state is null for unmounted component (#5724)
1 parent 6d61e94 commit 9ed5cca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎packages/sanity/src/core/form/inputs/CrossDatasetReferenceInput/useReferenceInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function useReferenceInfo(
7878
// workaround for a "bug" with useMemoObservable that doesn't
7979
// return the initial value upon resubscription
8080
const previousId = usePrevious(doc._id, doc._id)
81-
if (previousId !== doc._id) {
81+
if (doc._id && previousId !== doc._id) {
8282
return INITIAL_LOADING_STATE
8383
}
8484
return referenceInfo

0 commit comments

Comments
 (0)
Please sign in to comment.