You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug 🐛
Thank you so much for all the hard work on this codebase, it's incredibly helpful.
Probably a set up issue on my end and not a bug, but wondering what the recommended way to handle pagination AND facet/filtering together. The example app is fantastic and I was able to create a pretty amazing app quickly, replicating many complicated filter behaviors. The only hangup is when using a pagination with filter facets, the paginated data doesn't automatically refresh when filters are applied.
Specifically, using the algolia.searcher.paginatedData(of: Hit<StockItem>.self) as the hitsViewModel doesn't seem to respond to changes in filter facets. When changing the text query, the results update with the filters applied.
Are we doing things correctly? tried to follow the examples docs and connect the right things.
Is there a recommended way or example to handle pagination with filters connected?
Is there a better example to borrow from in the showcase you'd recommend?
Is this a config issue (e.g. the facet used in the Algolia portal is actually set to not be searchable or similar issue).
To Reproduce 🔍
Steps to reproduce the behavior:
Go to Examples Project for Algolia
Click on Search > PaginationSingleIndex
Add a facetListConnector to the SearchDemoSwiftUI.Controller using the demoController.searcher
Add a facetListController to the SearchDemoSwiftUI.Controller
Initialize the facetListConnector with attribute in the index. I used gender but other facets might work.
Connect the facetListConnector to the controller.
Add FacetList widget to the switUI view, using a FacetRow
structContentView:View{@StateObjectvarhitsViewModel:PaginatedDataViewModel<AlgoliaHitsPage<Hit<StoreItem>>>@ObservedObjectvarsearchBoxController:SearchBoxObservableController@ObservedObjectvarstatsController:StatsTextObservableController@ObservedObjectvarloadingController:LoadingObservableController@ObservedObjectvarfacetsListController:FacetListObservableControllervarbody:someView{VStack{HStack{Text(statsController.stats)Spacer()if loadingController.isLoading {ProgressView()}}.padding(.trailing,20)
// Apply Facet List Here
FacetList(facetsListController){ facet, isSelected inFacetRow(facet: facet, isSelected: isSelected)}
// Infinite Loading with Pagination
InfiniteList(hitsViewModel){ hit inProductRow(storeItemHit: hit).padding().frame(height:100)} noResults:{Text("No Results")}}.searchable(text: $searchBoxController.query).onSubmit(of:.search){
searchBoxController.submit()}.padding(.horizontal,15)}}
Expected behavior 💭
A clear and concise description of what you expected to happen.
When filters/facets are changed, paginated data should reload via the searcher in SwiftUI views using the InfiniteList widget.
Screenshots 🖥
If applicable, add screenshots to help explain your problem.
This screenshot shows the code changes showing a filter list used to filter gender.
When applying this filter, the paginated data doesn't update. Only when typing the text "Men" does it actually update.
Environment:
OS: iOS
Version 18.1, Xcode 16.1 and Xcode 16.2
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
RGG-jayoung
changed the title
Paged Data Source doesn't refresh when filters are applied, only when text query is active (example requested)
Paged Data Source doesn't refresh when filters are applied, only when text query is active (possible bug, example requested)
Dec 10, 2024
Describe the bug 🐛
Thank you so much for all the hard work on this codebase, it's incredibly helpful.
Probably a set up issue on my end and not a bug, but wondering what the recommended way to handle pagination AND facet/filtering together. The example app is fantastic and I was able to create a pretty amazing app quickly, replicating many complicated filter behaviors. The only hangup is when using a pagination with filter facets, the paginated data doesn't automatically refresh when filters are applied.
Specifically, using the
algolia.searcher.paginatedData(of: Hit<StockItem>.self)
as thehitsViewModel
doesn't seem to respond to changes in filter facets. When changing the text query, the results update with the filters applied.To Reproduce 🔍
Steps to reproduce the behavior:
facetListConnector
to theSearchDemoSwiftUI.Controller
using the demoController.searcherfacetListController
to theSearchDemoSwiftUI.Controller
gender
but other facets might work.facetListConnector
to the controller.FacetList
widget to the switUI view, using aFacetRow
The swiftUI view with the facet list added:
Expected behavior 💭
A clear and concise description of what you expected to happen.
When filters/facets are changed, paginated data should reload via the searcher in SwiftUI views using the InfiniteList widget.
Screenshots 🖥
If applicable, add screenshots to help explain your problem.
This screenshot shows the code changes showing a filter list used to filter gender.
When applying this filter, the paginated data doesn't update. Only when typing the text "Men" does it actually update.
Environment:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: