Open Kyle-Ye opened 7 months ago
Set AG_PRINT_CYCLES=2 & AG_TRAP_CYCLES=1
Hey @Kyle-Ye, I help out EmergeTools as the maintainer of Pow these days helping out and saw your bug report on Twitter. I haven't seen this issue come up but I don't have much experience with understanding the AttributeGraph either, most of what I'm finding when I start looking for help is related to Xcode beta issues that seem to be resolved or is ChatGPT-generated SEO garbage. I was wondering if you had any leads, or any tools I could use to inspect this, would love to help figure this out so others can use the library without issue!
You can check my old blog post and use AGDebugKit to debug it.
Here below is my finding:
=== AttributeGraph: cycle detected through attribute 278848 ===
=== Evaluation stack ===
frame 23.0: attribute 278896; count=1, index=0/1 PD
frame 22.0: attribute 278936; count=1, index=0/1 PD
frame 21.0: attribute 291472; count=1, index=0/1 PD
frame 20.0: attribute 292076; count=1, index=0/2 PD
frame 19.0: attribute 300172; count=1, index=0/2 PD
frame 18.0: attribute 306312; count=1, index=0/2 PD
frame 17.0: attribute 306572; count=1, index=0/2 PD
frame 16.0: attribute 311436; count=1, index=0/2 PD
frame 15.0: attribute 313528; count=1, index=0/3 PD
frame 14.0: attribute 313464; count=1, index=0/1 PD
frame 13.0: attribute 306808; count=1, index=0/2 PD
frame 12.0: attribute 307260; count=1, index=0/1 PD
frame 11.0: attribute 292276; count=1, index=0/2 PD
frame 10.0: attribute 292636; count=1, index=0/2 PD
frame 9.0: attribute 292736; count=1, index=0/1 PD
frame 8.0: attribute 293120; count=1, index=0/3 PD
frame 7.0: attribute 293056; count=1, index=0/1 PD
frame 6.0: attribute 293472; count=1, index=0/1 PD
frame 5.0: attribute 278488; count=1, index=0/1 PD
frame 4.0: attribute 280760; count=1, index=0/2 PD
frame 3.0: attribute 280856; count=1, index=0/1 PD
frame 2.0: attribute 285816; count=1, index=0/3 PD
frame 1.0: attribute 280896; count=1, index=0/2 PD
frame 0.0: attribute 278848; count=1, index=0/4 PD
===
And the cycled graph is the following ⬇️ (AG_PRINT_CYCLES=4)
digraph {
_286328[label="286328: DynamicContainer<DynamicLayoutViewAdapto…" fillcolor=cyan style="dashed,filled" color=red];
_285976 -> _286328[ color=red];
_286016[label="286016: _VStackLayout → LayoutComputer" fillcolor=cyan style="dashed,filled" color=red];
_286328 -> _286016[ color=red];
_285976[label="285976: DynamicViewList<_ConditionalContent<Empt…" fillcolor=cyan style="dashed,filled" color=red];
_285880 -> _285976[ color=red];
_285880[label="285880: Read: Toolbar" fillcolor=cyan style="dashed,filled" color=red];
_283608 -> _285880[ color=red];
_284056[label="284056: LayoutChildGeometry" fillcolor=cyan style="dashed,filled" color=red];
_284016 -> _284056[ color=red];
_284016[label="284016: LayoutChildGeometries" fillcolor=cyan style="dashed,filled" color=red];
_283968 -> _284016[ color=red];
_283968[label="283968: SheetContentRoot<_VStackLayout> → Layout…" fillcolor=cyan style="dashed,filled" color=red];
_286016 -> _283968[ color=red];
_283608[label="283608: $Toolbar" fillcolor=cyan style="dashed,filled" color=red];
_284872 -> _283608[ color=red label="@0"];
_292960[label="292960: PairPreferenceCombiner<ToolbarKey>" fillcolor=cyan style="dashed,filled" color=red];
_292544 -> _292960[ color=red];
_292608[label="292608: DynamicContainer<DynamicLayoutViewAdapto…" fillcolor=cyan style="dashed,filled" color=red];
_292224 -> _292608[ color=red];
_292544[label="292544: ∪+ Toolbar" fillcolor=cyan style="dashed,filled" color=red];
_292608 -> _292544[ color=red];
_292224[label="292224: DynamicViewList<_ConditionalContent<Modi…" fillcolor=cyan style="dashed,filled" color=red];
_292124 -> _292224[ color=red];
_292124[label="292124: SecondaryChild<PresentationBackgroundPre…" fillcolor=cyan style="dashed,filled" color=red];
_291764 -> _292124[ color=red];
_291764[label="291764: ∪+ PresentationBackgroundPreference.Key" fillcolor=cyan style="dashed,filled" color=red];
_306748 -> _291764[ color=red];
_291564[label="291564: LayoutChildGeometries" fillcolor=cyan style="dashed,filled" color=red];
_290960 -> _291564[ color=red label="@32"];
_290960[label="290960: _PaddingLayout → ChildGeometry" fillcolor=cyan style="dashed,filled" color=red];
_284056 -> _290960[ color=red label="@32"];
_306748[label="306748: PairPreferenceCombiner<PresentationBackg…" fillcolor=cyan style="dashed,filled" color=red];
_306296 -> _306748[ color=red];
_306296[label="306296: ∪+ PresentationBackgroundPreference.Key" fillcolor=cyan style="dashed,filled" color=red];
_312952 -> _306296[ color=red];
_306060[label="306060: LayoutChildGeometries" fillcolor=cyan style="dashed,filled" color=red];
_305800 -> _306060[ color=red label="@32"];
_305800[label="305800: SecondaryLayerGeometryQuery" fillcolor=cyan style="dashed,filled" color=red];
_299660 -> _305800[ color=red label="@32"];
_299660[label="299660: DynamicLayoutViewChildGeometry" fillcolor=cyan style="dashed,filled" color=red];
_291564 -> _299660[ color=red];
_313016[label="313016: DynamicContainer<DynamicLayoutViewAdapto…" fillcolor=cyan style="dashed,filled" color=red];
_312952[label="312952: ∪+ PresentationBackgroundPreference.Key" fillcolor=cyan style="dashed,filled" color=red];
_313016 -> _312952[ color=red];
_310924[label="310924: DynamicLayoutViewChildGeometry" fillcolor=cyan style="dashed,filled" color=red];
_306060 -> _310924[ color=red];
_284872[label="284872" shape=box];
_292960 -> _284872[label="@0"];
_284944 -> _284872[color=blue];
}
Hey @Kyle-Ye, assuming you mean this blog post I will admit that I'm not as fluent in Chinese as I am in English or Russian. 😅
Hey @Kyle-Ye, assuming you mean this blog post I will admit that I'm not as fluent in Chinese as I am in English or Russian. 😅
Oh, yeah. I forgot to post an English version for this post.
You can read it via Google Translate. If you have anything unclear you can contact me via email in English for the detail. My Preferred languages are: [Chinese > English > Japanese]
A mini reproductive demo here.
Will only break on macOS. Not on iOS/iPadOS/Mac Catalyst
import SwiftUI
import Pow
@main
struct DemoApp: App {
@State private var sheet = false
var body: some Scene {
WindowGroup {
Button("Open Sheet") {
sheet.toggle()
}
.sheet(isPresented: $sheet) {
Text("Demo")
.conditionalEffect(.smoke, condition: true)
}
}
}
}
This looks to be an upstream issue and have nothing to do with the repo.
Let's track the issue on upstream. https://github.com/EmergeTools/Pow/issues/63
Reproduce Steps
Click "Tap to Fix Everything"
Toggle and checkbox and click "Continue"
Line 4 is fine. But before line 6, you will get a warning about "=== AttributeGraph: cycle detected through attribute XXX ==="
This is actually a very dangerous warning and it means your app may crash at any point in a random later time.
Will check and fix it later. Please assign this issue to me
Env:
See related issue here: https://github.com/Kyle-Ye/Forumate/issues/28