Closed oskarrough closed 1 year ago
If a BaseQuery
class is not the way, maybe back to dropping a few components in each page that needs it. Speaking together with events.
Well, it's still better extending a base class than duplicating the code everywhere we want the search/filters/pagination.
I know we said we don't want more classes extending each other, but here is a try anyway to try and visualize the effects of it.
This avoids quite a bit of "complicated" logic being duplicated across pages and components, and now there's a clear path to follow when a page wants the query stuff.
r4-supabase-query
andr4-supabase-filter-search
Any component can now extend
BaseQuery
to get all the query goodness ready to go. Here's how:class MyComponent extends BaseQuery
this.query = { /* defaults */}
inside the constructorrender()
call${this.renderQuery()}
to insert the filter search + query uiNot sure this is the way, happy to hear any feedback. Now all the logic is basically inside these three, which could also be consolidated: