fix(ui): memory leak when getting image DTO

must unsubscribe!
This commit is contained in:
psychedelicious 2024-08-22 19:09:38 +10:00
parent 82f0cb2c8c
commit 5aa2957da4

View File

@ -580,8 +580,11 @@ export const getImageDTO = async (image_name: string, forceRefetch?: boolean): P
};
const req = getStore().dispatch(imagesApi.endpoints.getImageDTO.initiate(image_name, options));
try {
return await req.unwrap();
const imageDTO = await req.unwrap();
req.unsubscribe();
return imageDTO;
} catch {
req.unsubscribe();
return null;
}
};