diff --git a/.changeset/twenty-seals-allow.md b/.changeset/twenty-seals-allow.md new file mode 100644 index 000000000..513b8686a --- /dev/null +++ b/.changeset/twenty-seals-allow.md @@ -0,0 +1,5 @@ +--- +'hostd': minor +--- + +Fixed an error with "lastAnnouncement" that occurs the first time the configuration is saved. diff --git a/apps/hostd/contexts/config/useOnValid.tsx b/apps/hostd/contexts/config/useOnValid.tsx index 584c55d45..912cd89c7 100644 --- a/apps/hostd/contexts/config/useOnValid.tsx +++ b/apps/hostd/contexts/config/useOnValid.tsx @@ -52,7 +52,7 @@ export function useOnValid({ throw Error(response.error) } const needsToAnnounce = - host.data.lastAnnouncement?.address !== values.netAddress + host.data?.lastAnnouncement?.address !== values.netAddress if (needsToAnnounce) { triggerSuccessToast( 'Settings have been saved. Address has changed, make sure to re-announce the host.', @@ -69,7 +69,7 @@ export function useOnValid({ console.log(e) } }, - [showAdvanced, resources, settingsUpdate, revalidateAndResetForm, host] + [showAdvanced, resources, settingsUpdate, revalidateAndResetForm, host.data] ) return onValid }