Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Using orderings, pageSize, page, etc. in calls #10

@rudyrigot

Description

@rudyrigot

I'm looking into your library today, and I'm noticing that you are abstracting a lot how the kit performs queries. It's fine by itself, but it suppresses a key upside of the official kit: the ability to chain calls to specify your query. For instance:

api.forms('products').query('[[:d = at(document.tag, "featured")]]').orderings('[product.price]').pageSize(10).page(2).ref(ref).submit()

I wonder how best to expose this with the current approach. Maybe simply with a Prismic.api so that we can do stuff such as Prismic.api.forms('products').query('[[:d = at(document.tag, "featured")]]').orderings('[product.price]').pageSize(10).page(2).submit(). This might require to extend the original SearchForm object so that submit() returns a promise, but that could work!

Notice that I haven't used ref. I like the way you've abstracted the call to ref in a clean way, still making it possible to pass another ref in the page's URL.

I can totally make that happen, I just thought I'd reach out first to talk about how to do this best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions