Closed oskarrough closed 12 months ago
Name | Link |
---|---|
Latest commit | 74a071d8950379eec1f8cb857a6d7be4e2b7cfbe |
Latest deploy log | https://app.netlify.com/sites/radio4000-components/deploys/654e02a82b4bb7000856e204 |
Deploy Preview | https://deploy-preview-155--radio4000-components.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
OK, tried with extending our pages with a "BaseQuery" class. This works, seems pretty clean, but extending classes when in comes to custom elements doesn't feel right. So I went back to dropping a component <r4-base-query>
in the pages DOM instead, and rely on events.
SO, this is how it works now:
constructor() {
this.query = {table: 'channels'}
}
handleData(event) {
this.myData = event.detail.data
}
render() {
return html`
<r4-base-query .initialQuery=${this.query} .defaultFilters=${[]} @data=${this.handleData}></r4-base-query>
<p>We have ${this.myData?.length} rows</p>
`
}
The base query component will do this:
data
event on new dataYou can't stop it from rendering the filter controls atm. Probably we want more flexibility here? But in those cases we can also just skip the component and use r4-filter-search and r4-supabase-query directly.
Refactor of the query filter dance.
?search=funk jazz
and?order=asc/desc
. Works on /explore and /tracks. These are internally mapped to the supabase search filter and order config respectivelyurl-utils.js
for url query param handlingThere's still quite a lot of code to be added to any component that wants to all this query->filter->browse magic. I made a test class to try and extract it all. It goes something like this
query: {}
anddefaultFilters: []
get queryWithDefaults()
-> query incl.defaultFilters
andthis.query.search
filterconnectedCallback
-> set this.query from (known) URLSearchParamsdebouncedDataFetcher()
render()
-><r4-supabase-filter-search>
and<r4-supabase-query>
clearFilters()
-> setQuery@onQuery
-> setQuery@onSearchFilter
-> setQueryThese things have to be duplicated whereever we want the query interface. Thinking of ideas how to reduce it or improve it, but what we have also works.
Closes #154