diff --git a/changes/25787-ui-bugfix b/changes/25787-ui-bugfix new file mode 100644 index 0000000000..3589ba9a81 --- /dev/null +++ b/changes/25787-ui-bugfix @@ -0,0 +1,2 @@ +- Fixed UI bug in OS settings modal that caused status tooltip to flicker when refetching host + details. diff --git a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx index c4a70c453e..5fd00abada 100644 --- a/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx +++ b/frontend/pages/hosts/details/DeviceUserPage/DeviceUserPage.tsx @@ -541,12 +541,12 @@ const DeviceUserPage = ({ setSelectedCertificate(certificate); }; - const resendProfile = (profileUUID: string): Promise => { - if (!host) { - return new Promise(() => undefined); - } - return deviceUserAPI.resendProfile(deviceAuthToken, profileUUID); - }; + const resendProfile = useCallback( + (profileUUID: string): Promise => { + return deviceUserAPI.resendProfile(deviceAuthToken, profileUUID); + }, + [deviceAuthToken] + ); const renderDeviceUserPage = () => { const failingPoliciesCount = host?.issues?.failing_policies_count || 0; diff --git a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx index d26cbfe646..dfd3527d21 100644 --- a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx +++ b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx @@ -669,12 +669,15 @@ const HostDetailsPage = ({ } }; - const resendProfile = (profileUUID: string): Promise => { - if (!host) { - return new Promise(() => undefined); - } - return hostAPI.resendProfile(host.id, profileUUID); - }; + const resendProfile = useCallback( + (profileUUID: string): Promise => { + if (!host?.id) { + return new Promise(() => undefined); + } + return hostAPI.resendProfile(host.id, profileUUID); + }, + [host?.id] + ); const onChangeActivityTab = (tabIndex: number) => { setActiveActivityTab(tabIndex === 0 ? "past" : "upcoming");