kean / Pulse

Network logger for Apple platforms
https://pulselogger.com
MIT License
6.18k stars 294 forks source link

Search only displays 10 results. #257

Closed AgapovOne closed 2 months ago

AgapovOne commented 2 months ago

Hello. Started to use search and it's only showing 10 results after applying search.

Filters view works fine and shows all the results with proper count

Screenshot

![Simulator Screenshot - iPhone 15 - 2024-05-25 at 22 27 26](https://github.com/kean/Pulse/assets/4246455/2fcc887f-ec6a-430c-9504-2a1414c67f15)

Easy to reproduce:

Pulse-22-27-40.patch

I just added 15 messages instead of 1 in MockStore file.

        (0..<15).forEach { _ in
            logger(named: "analytics")
                .log(level: .debug, "Will navigate to Dashboard")
        }

UPD

Tried to fix this myself. I see that the search has always cutoff = 10 and adding total results might be too slow on a lot of data. So it might be good to display that total is uknkown, but now displaying 10 results.

If that will be implemented, still button 'Show more results' doesn't load more results, so fix still required.

Load more results doesn't work because searchOperationDidFinish makes operation nil, so there is nothing to start again.

I tried to not clear operation in didFinish method, then the load more results works, but I don't know if that would break any other logic, because I don't see tests.

I can have an attempt to fix this with tests, but I want to know if I should tackle this problem or you want to fix it yourself, @kean?

kean commented 2 months ago

Hey, thanks for the report! I haven't had a chance to look into it yet, and PRs are always welcome.

kean commented 2 months ago

Fixed in v4.2.2 and it now loads more results automatically as you scroll to the bottom.