Refresh product/chore/battery card only when actually visible

This commit is contained in:
Bernd Bestel
2022-12-26 20:22:38 +01:00
parent 76500c57bd
commit c934bfb7b3
3 changed files with 15 additions and 0 deletions

View File

@@ -2,6 +2,11 @@ Grocy.Components.BatteryCard = {};
Grocy.Components.BatteryCard.Refresh = function(batteryId) Grocy.Components.BatteryCard.Refresh = function(batteryId)
{ {
if (!$(".batterycard").is(":visible"))
{
return;
}
Grocy.Api.Get('batteries/' + batteryId, Grocy.Api.Get('batteries/' + batteryId,
function(batteryDetails) function(batteryDetails)
{ {

View File

@@ -2,6 +2,11 @@ Grocy.Components.ChoreCard = {};
Grocy.Components.ChoreCard.Refresh = function(choreId) Grocy.Components.ChoreCard.Refresh = function(choreId)
{ {
if (!$(".chorecard").is(":visible"))
{
return;
}
Grocy.Api.Get('chores/' + choreId, Grocy.Api.Get('chores/' + choreId,
function(choreDetails) function(choreDetails)
{ {

View File

@@ -2,6 +2,11 @@ Grocy.Components.ProductCard = {};
Grocy.Components.ProductCard.Refresh = function(productId) Grocy.Components.ProductCard.Refresh = function(productId)
{ {
if (!$(".productcard").is(":visible"))
{
return;
}
Grocy.Api.Get('stock/products/' + productId, Grocy.Api.Get('stock/products/' + productId,
function(productDetails) function(productDetails)
{ {