MojtabaHs / iPhoneNumberField

Elegant SwiftUI phone number textField.
MIT License
542 stars 90 forks source link

cycle detected through attribute #102

Closed realszopen closed 4 months ago

realszopen commented 7 months ago

This happens on current release of iPhoneNumberField when trying to edit empty text field with placeholder text in place. It does not happen when editing text field with text already in place.

=== AttributeGraph: cycle detected through attribute 842776 === === AttributeGraph: cycle detected through attribute 580900 === === AttributeGraph: cycle detected through attribute 580900 === === AttributeGraph: cycle detected through attribute 580900 === === AttributeGraph: cycle detected through attribute 580900 ===

keenan-chiasson commented 6 months ago

Experiencing this as well. Any updates?

tonybruess commented 6 months ago

Looks like a fix was merged but a release was never published: https://github.com/MojtabaHs/iPhoneNumberField/pull/76

realszopen commented 6 months ago

That's actually interesting. I used to experience this cycle graph in more situations. Now the number of cases seems actually smaller. Nevertheless, I have downgraded iPhoneNumberField in production app and using old version while waiting for release with fix.

freywaid commented 6 months ago

I would like to use this package except for these cycle errors. Can we merge the PR that fixes this?

MojtabaHs commented 6 months ago

@realszopen @tonybruess @keenan-chiasson

Please:

This way the final merged code will have a manual test file and your name as a contributer on it 🙌🏻

MojtabaHs commented 6 months ago

I would like to use this package except for these cycle errors. Can we merge the PR that fixes this?

@freywaid Since I can't reproduce the original issue, you may want to directly use the PR (temporary) in your project until some one is able to make a Test-Case-PR as I described above.

realszopen commented 6 months ago

Done PR #103

MojtabaHs commented 6 months ago

I can't reproduce the issue. What I've done:

I have done the above steps rotating (like starting from the 4th step to the end and then from step 1 to the 4th) but again, no issues.

Please specify the exact steps to reproduce the issue on the Demo app so we will be on the same page.

ps: you can use the following to make your case run on the demo app as your previewed:

struct MultiplatformDemoApp: App {
    @State var number: String = ""

    var body: some Scene {
        WindowGroup {
            ContentView()
            if #available(iOS 15.0, *) {
                iPhoneNumberFieldTestView(placeholderText: "GOTACHA", mainText: $number)
            }
        }
    }
}

Also, don't forget to pull the necessary changes I've made to your PR first!

freywaid commented 6 months ago

I appreciate you trying to find the issue without any input from me. The issue arises when I'm using a binding to an optional string:

func ??(lhs: Binding<Optional>, rhs: T) -> Binding {

Binding(

    get: { lhs.wrappedValue ?? rhs },

    set: { lhs.wrappedValue = $0 }

)

}

struct MyView: View {

@Binding var text: String?

var body: some View {

    iPhoneNumberField(text: $text ?? "")

}

}

On Sat, May 18, 2024 at 1:44 AM Seyed Mojtaba Hosseini Zeidabadi < @.***> wrote:

I can't reproduce the issue. What I've done:

  • Tap on the empty field - (nothing strange)
  • Tap on the numbers - (nothing strange)
  • Tap on the clear button until it is empty - (nothing strange)
  • Tap on the clear button while it is already empty - (nothing strange)
  • Repeat with adding *, # and + signs - (nothing strange)
  • Tap on the flag - (nothing strange)
  • Select different countries - (nothing strange)

I have done the above steps rotating (like starting from the 4th step to the end and then from step 1 to the 4th) but again, no issues.

Please specify the exact steps to reproduce the issue on the Demo app so we will be on the same page.

ps: you can use the following to make your case run on the demo app as your previewed:

struct MultiplatformDemoApp: App { @State var number: String = ""

var body: some Scene {
    WindowGroup {
        ContentView()
        if #available(iOS 15.0, *) {
            iPhoneNumberFieldTestView(placeholderText: "GOTACHA", mainText: $number)
        }
    }
}

}

— Reply to this email directly, view it on GitHub https://github.com/MojtabaHs/iPhoneNumberField/issues/102#issuecomment-2118708047, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACY6IC2AAXGFYRAHUYODTWDZC4IGBAVCNFSM6AAAAABGORVEX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJYG4YDQMBUG4 . You are receiving this because you were mentioned.Message ID: @.***>

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.