Skip to content

Commit

Permalink
Further performance adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Feb 14, 2024
1 parent bab6ae4 commit 40109a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Sources/PlaybookUI/Internal/Utilities/ImageLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ private extension ImageLoader {
}

guard !item.isCancelled else {
queue.removeFirst()
return startNext()
}

Expand All @@ -62,7 +61,6 @@ private extension ImageLoader {
}

guard !item.isCancelled else {
queue.removeFirst()
return startNext()
}

Expand Down Expand Up @@ -93,7 +91,6 @@ private extension ImageLoader {
item.continuation?.resume(returning: image)
item.continuation = nil
imageCache.create(file: data, for: item.source)
queue.removeFirst()
startNext()
}
}
Expand All @@ -104,7 +101,8 @@ private extension ImageLoader {
return
}

if sequentiallyProcessedCount < 4 {
if sequentiallyProcessedCount < 3 {
queue.removeFirst()
start()
}
else {
Expand All @@ -114,6 +112,7 @@ private extension ImageLoader {
}

sequentiallyProcessedCount = 0
queue.removeFirst()
start()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/PlaybookUI/Internal/Views/GalleryKindRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal struct GalleryKindRow: View {
.padding(.horizontal, 24)

ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(alignment: .top, spacing: 0) {
LazyHStack(spacing: 8) {
ForEach(data.scenarios, id: \.scenario.name) { data in
Button {
onSelect(data)
Expand Down
2 changes: 1 addition & 1 deletion Sources/PlaybookUI/Internal/Views/GalleryThumbnail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal struct GalleryThumbnail: View {
.onChange(of: colorScheme) { _ in
image = nil
}
.task(id: colorScheme) {
.task(id: colorScheme, priority: .background) {
let source = ImageSource(
scenario: data.scenario,
kind: data.kind,
Expand Down

0 comments on commit 40109a7

Please sign in to comment.