Closed metsfan closed 3 years ago
Hi @metsfan , thanks for reporting. I’ve prepared a pull-request for it, is this the change you suggest?
I’ve released a beta version and once I run some tests tomorrow I’ll have a hotfix release ready
Yes, thanks you!
Describe the bug This seems to be a new bug after updating from 1.11.0 to 1.14.0. If the
$page
binding is set to a@Published
property of an ObservableObject, there will be an infinite loop. Pager.swift on line 198, the page is being set onReceive, which triggers a change to the Published property, which triggers a view refresh, and this cycle will continue infinitely. This could be fixed by simply checking to be sure that the value is different before updating the page.I was able to work around this by putting a local
@State
variable in my view which I then listen for and only make the state update to my ViewModel if the value is actually different but IMO this should be handled by the pager to reduce extra potential page renders.To Reproduce Bind the page variable to a @Published property from an ObservableObject
Expected behavior The pager will loop infinitely and the app will never start
Environment: