Hi. looking for some best practices advice for sorting a collection. if I use Xano integration and fetch from Xano built-in GET /table_name API, i get all the records, but they are not sorted by default. Am I better to sort them in Xano or do it in weweb? Reasons for your answer?
I would do it in Xano. Especially when also using pagination, which I also would do in Xano. In combination with the paginator component it works very well. Doing the paging at Xano side is more efficient, in that case you only load the data that sounds be visible on that page. For pagination in Weweb you need to fetch the total collection, which is not feasible with large data sets.
You send sort column and sort direction to Xano, and fetch the sorted data for a specific page.
Thanks for the advice. Back-end it is!
With Supabase and Realtime Database, sorting must be done on frontend. Trying to apply sort on Supabase Collection (using plugin) is not working after database is updated with Realtime ON.
@Dominic Should in the case of Realtime Database with Supabase pagination and filtering also be done in the front-end. Or can you do it hybrid (which in my opinion would not work). For example (having back-end pagination as requirement) :
- Pagination: Backend
- Filtering: Back-End
- Sorting: Front-End
or
- Pagination: Backend
- Filtering: Front-End
- Sorting: Front-End
@FHEXL I’m not an expert on Supabase. I gave up and switched to Xano , but I think that you have to decide and do all thing either on front or backend depending of the payload.
Remember that if you paginate on backend you will only get some portion of data (page) on formtend and you will be sorting only this part. Maybe @Broberto could give you more advice on that.
All the features (Sorting and Filtering) should work on Realtime tables, not views, so that’s one thing to make clear, just in case. Also as Dominic mentioned, by paginating in Supabase, you might not get the “feedback” of your realtime, as it might not be included in that page, I would really need to see the usecase to advice a specific solution.
My assumption is also to do everything in the same environment either being front-end or backend.
I also use Xano, but planning to try out Supabase also. Maybe in combination with Buildship.
Xano, as always keep your front end as “dumb” as possible and make all your logic on the back end if possible