Skip to content
Merged
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
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 27 15:14:35 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

- Invalidate all software queries when the selected product changes
(gh#agama-project/agama#2517).

-------------------------------------------------------------------
Fri Jun 27 11:23:29 UTC 2025 - José Iván López González <[email protected]>

Expand Down
25 changes: 7 additions & 18 deletions web/src/queries/software.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ const licensesQuery = () => ({
staleTime: Infinity,
});

/**
* Query to retrieve selected product
*/
const selectedProductQuery = () => ({
queryKey: ["software", "product"],
queryFn: () => fetchConfig().then(({ product }) => product),
});

/**
* Query to retrieve registration info
*/
Expand Down Expand Up @@ -166,9 +158,7 @@ const useConfigMutation = () => {
const query = {
mutationFn: updateConfig,
onSuccess: async (_, config: SoftwareConfig) => {
queryClient.invalidateQueries({ queryKey: ["software", "config"] });
queryClient.invalidateQueries({ queryKey: ["software", "product"] });
queryClient.invalidateQueries({ queryKey: ["software", "proposal"] });
queryClient.invalidateQueries({ queryKey: ["software"] });
if (config.product) {
await systemProbe();
queryClient.invalidateQueries({ queryKey: ["storage"] });
Expand Down Expand Up @@ -238,20 +228,20 @@ const useProduct = (
): { products?: Product[]; selectedProduct?: Product } => {
const func = options?.suspense ? useSuspenseQueries : useQueries;
const [
{ data: selected, isPending: isSelectedPending },
{ data: config, isPending: isConfigPending },
{ data: products, isPending: isProductsPending },
] = func({
queries: [selectedProductQuery(), productsQuery()],
}) as [{ data: string; isPending: boolean }, { data: Product[]; isPending: boolean }];
queries: [configQuery(), productsQuery()],
}) as [{ data: SoftwareConfig; isPending: boolean }, { data: Product[]; isPending: boolean }];

if (isSelectedPending || isProductsPending) {
if (isConfigPending || isProductsPending) {
return {
products: [],
selectedProduct: undefined,
};
}

const selectedProduct = products.find((p: Product) => p.id === selected);
const selectedProduct = products.find((p: Product) => p.id === config.product);
return {
products,
selectedProduct,
Expand Down Expand Up @@ -371,7 +361,7 @@ const useProductChanges = () => {

return client.onEvent((event) => {
if (event.type === "ProductChanged") {
queryClient.invalidateQueries({ queryKey: ["software", "config"] });
queryClient.invalidateQueries({ queryKey: ["software"] });
}

if (event.type === "LocaleChanged") {
Expand Down Expand Up @@ -423,7 +413,6 @@ const useConflictsChanges = () => {
export {
configQuery,
productsQuery,
selectedProductQuery,
useAddons,
useConfigMutation,
useConflicts,
Expand Down
4 changes: 0 additions & 4 deletions web/src/queries/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { fetchInstallerStatus } from "~/api/status";
import { useInstallerClient } from "~/context/installer";
import { InstallerStatus } from "~/types/status";
import { QueryHookOptions } from "~/types/queries";
import { selectedProductQuery } from "./software";

const MANAGER_SERVICE = "org.opensuse.Agama.Manager1";

Expand Down Expand Up @@ -70,9 +69,6 @@ const useInstallerStatusChanges = () => {
case "IssuesChanged":
queryClient.invalidateQueries({ queryKey: ["status"] });
break;
case "ProductChanged":
queryClient.invalidateQueries({ queryKey: selectedProductQuery().queryKey });
break;
case "InstallationPhaseChanged":
if (!data) {
console.warn("Ignoring InstallationPhaseChanged event", event);
Expand Down