From b93df71431770a2502728931fc0d21fc481ef4a6 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Mon, 1 Jan 2024 11:39:32 +0100 Subject: [PATCH] Don't resize images if same size --- .../Sources/DesignSystem/Views/LazyResizableImage.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/LazyResizableImage.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/LazyResizableImage.swift index b8833dbc..5b06a46b 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/LazyResizableImage.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/LazyResizableImage.swift @@ -30,7 +30,8 @@ public struct LazyResizableImage: View { content(state, proxy) } .processors([resizeProcessor == nil ? .resize(size: proxy.size) : resizeProcessor!]) - .onChange(of: proxy.size, initial: true) { _, newValue in + .onChange(of: proxy.size, initial: true) { oldValue, newValue in + guard oldValue != newValue else { return } debouncedTask?.cancel() debouncedTask = Task { do { try await Task.sleep(for: .milliseconds(200)) } catch { return }