-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Runtime warning on pushing multiple items into NavigationStackController (TCA only) #248
base: main
Are you sure you want to change the base?
Fix Runtime warning on pushing multiple items into NavigationStackController (TCA only) #248
Conversation
Hi @loongallday, thanks for taking the time to look into this, however your changes do break the test suite:
You can run the tests in the Examples project to see these failures for yourself. Would you be interested in looking into a fix? Without looking into the issue very much I can definitely say that your change must be tweaked a bit. With the way the logic is now nothing is ever appending indices to |
Thanks, @mbrandonw I'll look into it but from basic inspecting I accidentally change the min iOS version to 15 since I wanna test with both version but forgot to change it back, will try that and run the test locally again :) |
silly me, I put the the isEmtpy check in the wrong position facepalm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @loongallday! This is the exact fix we planned on making when the issue was originally brought up, but we lost track of it. Will merge and release soon.
@loongallday One last question... would you happen to know how to write a test that triggers the runtime warning without this change? It would be nice to get some test coverage on this behavior. |
@mbrandonw thanks for approval Brandon ! but to reproduce the warning might be impossible if we don't import NavigationStack+Observation from swift-composable-architecture (the warning is in there) possible test might be to create scenario to execute this else block (push > 1 vc) right here in but how to write it, im not really sure about that since it's not really related to the NavigationStackController but more about the swift's underlying syntax, and how _UIBindingAppendKeyPath works. Here's the code block i've mentioned (in NavigationStackController)
Here's the
which is called from the setter block of
as i've tracked this exact line is executed when pushing multiple viewController it enters the else block which i modified the code to fix the runtime warning and the culprit was the exact line i adjust
this line triggers the binding's setter twice when executing it (Please correct me if im wrong here), resulting in a run time warning in NavigationStack+Observation above You can try to reproduce it to get a better idea from the minimal project i attached here |
as per
https://pointfreecommunity.slack.com/archives/C04KQQ7NXHV/p1730815911553849