@@ -365,13 +365,14 @@ public struct FlowLink<Label>: View where Label: View {
365365 . onButtonGesture {
366366 buttonPressed = true
367367 // check for sibling elements and return early if we already have a presented element at this depth
368- guard !hasSiblingElement else {
369- return
370- }
368+ guard !hasSiblingElement else { return }
371369 Task {
372370 if configuration. transitionFromSnapshot {
373- context? . snapshot = snapshots [ colorScheme]
371+ initSnapshots ( )
372+ self . context? . snapshotDict = snapshots
373+ self . context? . snapshot = snapshots [ colorScheme]
374374 }
375+
375376 if let value = value {
376377 withTransaction ( transaction) {
377378 path? . wrappedValue. append ( value, context: context)
@@ -402,11 +403,9 @@ public struct FlowLink<Label>: View where Label: View {
402403 }
403404 }
404405 . onChange ( of: colorScheme) { newScheme in
405- refreshButton = UUID ( )
406- snapshots [ newScheme]
407406 path? . wrappedValue. updateSnapshots ( from: newScheme)
407+ refreshButton = UUID ( )
408408 }
409- . onAppear { initSnapshots ( ) }
410409 . background (
411410 GeometryReader { proxy in
412411 Color . clear
@@ -460,14 +459,11 @@ public struct FlowLink<Label>: View where Label: View {
460459 }
461460
462461 private func initSnapshots( ) {
463- Task {
464- // Prevent Snapshot from being taken too early before Fetchable content loads
465- try ? await Task . sleep ( 10000 )
466- let lightImage = createSnapshot ( colorScheme: . light)
467- let darkImage = createSnapshot ( colorScheme: . dark)
468- snapshots [ . light] = lightImage
469- snapshots [ . dark] = darkImage
470- }
462+ guard snapshots. isEmpty else { return }
463+ let lightImage = createSnapshot ( colorScheme: . light)
464+ let darkImage = createSnapshot ( colorScheme: . dark)
465+ self . snapshots [ . light] = lightImage
466+ self . snapshots [ . dark] = darkImage
471467 }
472468}
473469
0 commit comments