From 7c1cd6574e8fc9389220a95f08f20874054f4d54 Mon Sep 17 00:00:00 2001 From: Loretta Date: Fri, 21 Nov 2025 17:16:59 +0100 Subject: [PATCH] OrderItemGrid improvement, fixes --- .../Components/GridDetailOrderItemDto.razor | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor b/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor index bf0da5f..5a879d2 100644 --- a/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor +++ b/FruitBankHybrid.Shared/Components/GridDetailOrderItemDto.razor @@ -10,7 +10,7 @@ @inject FruitBankSignalRClient FruitBankSignalRClient ().UseWaitAsync()) + + using (await ObjectLock.GetSemaphore().UseWaitAsync()) { - // if (ProductDtos == null || !ProductDtos.Any()) - // { - // ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); - - // // Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x => - // // { - // // ProductDtos = x.Result; - // // }).Forget(); - // } + if (ProductDtos == null || !ProductDtos.Any() || forceReload) ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); } - if (!IsMasterGrid) return; - - using (await ObjectLock.GetSemaphore().UseWaitAsync()) + if (IsMasterGrid) { - if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []; - else if (OrderItemDtos.Count == 0 || forceReload) + using (await ObjectLock.GetSemaphore().UseWaitAsync()) { - OrderItemDtos.Clear(); - OrderItemDtos.AddRange(await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []); + if (OrderItemDtos == null) OrderItemDtos = await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []; + else if (OrderItemDtos.Count == 0 || forceReload) + { + OrderItemDtos.Clear(); + OrderItemDtos.AddRange(await FruitBankSignalRClient.GetAllOrderItemDtos() ?? []); + } } - } - //if (forceReload) + // if (ProductDtos == null || !ProductDtos.Any() || forceReload) + // { + // //ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); + + // Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x => + // { + // ProductDtos = x.Result; + // }).Forget(); + // } + + //if (forceReload) Grid?.Reload(); - - if (ProductDtos == null || !ProductDtos.Any() || forceReload) - { - //ProductDtos = await Database.ProductDtoTable.LoadDataAsync(!forceReload); - - Database.ProductDtoTable.LoadDataAsync(!forceReload).ContinueWith(x => - { - ProductDtos = x.Result; - }).Forget(); } + LoadingPanelVisibility.Visible = false; } } \ No newline at end of file