Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for pagination #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

add support for pagination #12

wants to merge 6 commits into from

Conversation

4www
Copy link
Contributor

@4www 4www commented Apr 15, 2023

Adds:

  • utils.getBrowsePageParams() → can be used by all models, to get a paginated version of the results
  • channel.browseChannels → an implementation for the channels model

Moved from: https://github.com/radio4000/components/blob/main/src/components/r4-list.js#L125-L146

The web-component version is currently more modular, as it allows all parameters passed to supabase to be customized from the web component attributes.

* @returns {Promise<ReturnObj>}
*/

export const browseChannels = async ({page, limit}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we have readChannels(limit) and browseChannels({page, limit}.

How putting them together in readChannels({limit, page}) or readChannels(limit, page)?

Copy link
Contributor Author

@4www 4www Apr 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sounds cool too, passing an object sounds nice to me.

Also I keep thinking about this function here https://github.com/radio4000/components/blob/main/src/components/r4-list.js#L125-L146 where it allows all models to use the same function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example what if we browse "tracks" in a radio channel, and want to order them by title?

  • do we want that?
  • do we prefer having "just a search"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, these params (page, limit) will all be also bound to the URL, I guess this won't be in the sdk though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's change readChannels then.

There must be many smart abstractions we can do. I feel for now we can experiment in r4-app by writing sdk.supabase.from() queries directly? And once we know the patterns move them to the sdk.

@oskarrough
Copy link
Contributor

Is this still relevant now that we have sdk.browse() ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants