Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/37012-host-details-activity-upcoming-count
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed an issue where the upcoming activity count on the host details page was not updated after installing or uninstalling software.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useEffect,
} from "react";
import { InjectedRouter } from "react-router";
import { useQuery } from "react-query";
import { useQuery, useQueryClient } from "react-query";
import { AxiosError } from "axios";

import hostAPI, {
Expand Down Expand Up @@ -139,6 +139,8 @@ const HostSoftwareLibrary = ({
currentUser,
} = useContext(AppContext);

const queryClient = useQueryClient();

const isUnsupported = isAndroid(platform); // no Android software
const isWindowsHost = platform === "windows";
const isIPadOrIPhoneHost = isIPadOrIPhone(platform);
Expand Down Expand Up @@ -500,6 +502,9 @@ const HostSoftwareLibrary = ({
if (isMountedRef.current) {
onInstallOrUninstall();
}
queryClient.invalidateQueries({
queryKey: [{ scope: "upcoming-activities" }],
});

const message = () => {
switch (true) {
Expand All @@ -524,7 +529,7 @@ const HostSoftwareLibrary = ({
renderFlash("error", getInstallErrorMessage(e));
}
},
[id, renderFlash, onInstallOrUninstall, isHostOnline]
[id, renderFlash, onInstallOrUninstall, isHostOnline, queryClient]
);

const onClickUninstallAction = useCallback(
Expand All @@ -534,6 +539,9 @@ const HostSoftwareLibrary = ({
if (isMountedRef.current) {
onInstallOrUninstall();
}
queryClient.invalidateQueries({
queryKey: [{ scope: "upcoming-activities" }],
});
renderFlash(
"success",
<>
Expand All @@ -548,7 +556,7 @@ const HostSoftwareLibrary = ({
renderFlash("error", getUninstallErrorMessage(e));
}
},
[id, renderFlash, onInstallOrUninstall, isHostOnline]
[id, renderFlash, onInstallOrUninstall, isHostOnline, queryClient]
);

const tableConfig = useMemo(() => {
Expand Down
Loading