Skip to content

Commit 1a89a04

Browse files
committed
🩹 [#266] fix AddressNL crash inside of EditGrid component
When the user click on the "Add another" or "Edit item" button then it triggers 'onClick' event for the EditGrid item button, which uses onChange and flushSync under the hood. Durin flushSync the AddressNl component is being updated and loaded, but when it happens the 'values' in the FormikContext are not updated, so the 'addressData' is undefined.
1 parent db0741c commit 1a89a04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/registry/addressNL/deriveAddress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const useDeriveAddress = (key: string, enabled: boolean): UseDeriveAddres
3434

3535
// debounce to avoid rapidly firing updates when the user is typing
3636
const addressData = useDebounce(value, 300);
37-
const {postcode, houseNumber} = addressData;
37+
const {postcode, houseNumber} = addressData ?? {};
3838

3939
// if postcode/house number change, check if we need to clear the derived inputs
4040
useEffect(() => {

0 commit comments

Comments
 (0)