Skip to content
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

[BUG] To many pageView request #311

Open
kelalaka153 opened this issue Feb 11, 2023 · 0 comments
Open

[BUG] To many pageView request #311

kelalaka153 opened this issue Feb 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kelalaka153
Copy link

Describe the bug

I'm running a simplified example to test for my purpose;

    var body: some View {
            GeometryReader { proxy in
                VStack(spacing: 10) {
                    Pager(page: self.page1,
                          data: self.data1,
                          id: \.self) {
                            self.pageView($0)
                    }
                    .contentLoadingPolicy(.lazy(recyclingRatio: 2)) // more problem with the eager policy 
                    .pagingPriority(.simultaneous)
                    .sensitivity(.high)
                    .itemSpacing(10)
                }
            }
    }

with additionally printing page requests

func pageView(_ page: Int) -> some View {
        
        print("Page request for \(page)")

gettting

App State: inactive
Page request for 0
Page request for 0
Page request for 1
Page request for 1
App State: active
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 0
Page request for 1
Page request for 2
Page request for 2

Expected behavior

It seams that the slower the page transitions the more page request exist. I want a single call since each of the pages get data from the database, for each call, the database query will be executed again.

Environment:

  • OSX: IOS 16.2
  • Device : iPhone 14 pro emulator
  • SwiftUIPager version : Main ( sorry, couldn't find a way to see the version numbering on the package)

Additional context

Is there a way to only load/prepare the neighbor pages with only one call per page?

@kelalaka153 kelalaka153 added the bug Something isn't working label Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant