Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 14:10

    ddnexus on dev-5.0

    wrap all extras in their own mo… updated vscode files more conventional reformat of r… and 10 more (compare)

  • 01:30

    ddnexus on dev-5.0

    added launch configuration for … internal renaming and re-format… url helpers refactoring and 1 more (compare)

  • Sep 17 08:24
    benkoshy commented #333
  • Sep 16 11:19

    ddnexus on dev-5.0

    updated gemfiles added launch configuration for … small code and formatting impro… (compare)

  • Sep 15 09:12
    ddnexus assigned #314
  • Sep 15 02:56

    ddnexus on dev-5.0

    updated to rubocop 1.21 (compare)

  • Sep 15 02:44

    ddnexus on dev-5.0

    fix for actions (compare)

  • Sep 15 02:42

    ddnexus on dev-5.0

    fix for actions (compare)

  • Sep 15 02:41

    ddnexus on dev-5.0

    updated gemfiles fix for actions (compare)

  • Sep 15 02:08

    ddnexus on dev-5.0

    updated vscode files more conventional reformat of r… more conventional formatting of… and 1 more (compare)

  • Sep 14 11:34

    ddnexus on dev-5.0

    wrap all extras in their own mo… (compare)

  • Sep 14 06:03

    ddnexus on dev-5.0

    refactoring of Pagy and Pagy::C… fix meilisearch and searchkick … fix for Pagy.items_selector emp… and 7 more (compare)

  • Sep 13 11:10

    ddnexus on dev-5.0

    added gearbox extra, doc and te… renamed :enable_items_extra > :… renamed :enabled_trim_extra > :… and 3 more (compare)

  • Sep 13 09:26

    ddnexus on dev-5.0

    fix for Pagy.items_selector emp… added gearbox extra, doc and te… renamed :enable_items_extra > :… and 2 more (compare)

  • Sep 12 13:40

    ddnexus on dev-5.0

    Removed support for deprecated … Removed support for deprecated … Removed support for deprecated … and 4 more (compare)

  • Sep 12 13:39

    ddnexus on dev

    renamed COVERAGE_REPORT to HTML… fix for md formatting WIP: basic VSC config files and 3 more (compare)

  • Sep 12 13:35

    ddnexus on master

    added better test reporting for… updated cypress dockerfiles fix for simplecov not catching … and 6 more (compare)

  • Sep 12 12:57

    ddnexus on dev-5.0

    renamed COVERAGE_REPORT to HTML… fix for md formatting WIP: basic VSC config files and 10 more (compare)

  • Sep 12 04:20

    ddnexus on experiments

    (compare)

  • Sep 12 03:50

    ddnexus on experiments

    renamed COVERAGE_REPORT to HTML… fix for md formatting WIP: basic VSC config files and 2 more (compare)

basicfeatures
@basicfeatures
Anyway to each his own. I'm now using Pagy with Stimulus.js infinite scrolling so it doesn't matter to me.
Wish you all a wonderful day. And thanks so much for making such a wonderful tool.
Domizio Demichelis
@ddnexus
Thanks for the thanks
Ben Koshy
@benkoshy
Came across a github action which publishes to ruby gems automatically. would this be useful / save time?
Domizio Demichelis
@ddnexus
Hey Ben, I didn't use that because I was not sure it would fit with the current way I use master. I push commits that are just doc or test that don't require the release, but do require to be in master. Wouldn't that trigger a release push?
Currently I use a rake task that automates the release process, but I trigger it manually when needed.
Domizio Demichelis
@ddnexus
That is not a big advantage, also considering that using it from docker requires some extra attention, so if you can investigate whether there is a simple and reliable way to trigger that action only when needed, I will be happy to switch.
Ben Koshy
@benkoshy

Hey Ben, I didn't use that because I was not sure it would fit with the current way I use master. I push commits that are just doc or test that don't require the release, but do require to be in master. Wouldn't that trigger a release push?

I'm quite confident it can be customized to suit your workflow. e.g. publishing to ruby gems only when you add a tag which begins with "v4.0.01". I will have a look further, it looks interesting. please let me know if this will be more beneficial, or if it complicates things. my goal is to make it slightly easier for you, not more difficult.

Domizio Demichelis
@ddnexus
the tag could be a good idea... so unless I create and push a tag it will not push the gem. ATM the rake task creates and pushes the tag too.
BTW, another way to do it could be creating the a action as a workflow itself and not a step in the current workflow. At that point there is probably no need to put any automatic trigger that check stuff, but just use the manual run of the workflow through the github interface
Domizio Demichelis
@ddnexus
And that would be easier than a task, since I always have to check that the tests passed in github before releasing, so I will be already using the github UI.
Ben Koshy
@benkoshy
Let me see if i can come back with a PR for this.
Rafael Mora
@titanve

Hello 👋 everyone!
I'm setting the size: [1, 1, 1, 1] to my pagy and the total calculated pages are 9 and when I go to the 4th page (also happens when I go to the 6th page) I get this series: [1, 2, 3, "4", 5, :gap, 9]. As I specified in my size param I want 1 before the current_page but I'm getting 2 pages. My expected output is series: [1, :gap, 3, "4", 5, :gap, 9] Am I doing something wrong?

I do get my expected output when I go to the 5th page: series: [1, :gap, 4, "5", 6, :gap, 9]

Thank you for your help.

Rafael Mora
@titanve
Issue demo:
pagyseries.gif
Domizio Demichelis
@ddnexus
@titanve you are doing nothing wrong nor do pagy. That is a real-estate/UI-optimization feature. There is no advantage occupying a page slot with ... when the gap is exactly one page, so instead of a very useless ..., pagy puts the otherwise missing link to the page. When there are 2 or more missing pages, then the gap makes sense.
Rafael Mora
@titanve
Ok, understood thank you for your help @ddnexus
Sebastián Meza
@sebackend
Hi there :hand:
i recently discover this awesome gem, congrats to the people responsible for its development
is there a way to do ajax/remote pagination with it? i can't find anything related to, not even a blog post or an issue on github...any idea?
Domizio Demichelis
@ddnexus
David McDonald
@daveomcd
I am using pagy on a web page to display records. I have a toggle link on the page to filter those records. The link calls a post recquest to another controller that executes javascript to reupdate the partial that's using pagy. It's causing my links to use the url from that post though... how can i modify this? I checked out the documentation but not seeing it. Can someone point me in the right direction?
David McDonald
@daveomcd
ended up overwriting the "pagy_url_for" and used root_url(params)
Domizio Demichelis
@ddnexus
@daveomcd why do you need a different controller just to filter the records? Overriding pagy_url_forand using root_url makes me think that you are using the wrong way to get a simple thing... unless your description misses some important detail
Ben Koshy
@benkoshy
It's causing my links to use the url from that post though... how can i modify this?
2 replies
Marc Köhlbrugge
@marckohlbrugge

I just noticed when using Pagy, my app was always doing a full SELECT posts.* despite using fragment caching. I would expect it do only do a full SELECT on the first request, and on subsequent request do a faster SELECT COUNT(*) AS "size", MAX(subquery_for_cache_key.collection_cache_key_timestamp) AS timestamp FROM (SELECT … and then use the cached fragment instead.

After some digging, I realized it's because the Countless extra does a .to_a on the collection in order to see if there are further pages. I don't know if there's a way around that, but I thought it would be worth mentioning on the https://ddnexus.github.io/pagy/api/countless.html#caveats page so people are aware of this. What do you think @ddnexus ?

In other words, using the Countless extra will always eager-load the collection.
Marc Köhlbrugge
@marckohlbrugge
Ok, so interesting observation. Turns out that after removing the Countless extra, the added COUNT(*)query takes more time than we save using fragment caching. See before/after of removing the countless extra:
telegram-cloud-photo-size-2-5249251245137442197-y.jpg
So I'll revert back to using Countless, despite its eager-loading rendering the fragment cache useless
Or is there a way to do away with the COUNT(*) query, and just accept that Pagy doesn't know whether there's a next page? Because I'm using infinite scrolling, I don't mind it trying to load an empty page. It can just assume there's a next page, and so eventually it will just load a page without any items. That's fine
Domizio Demichelis
@ddnexus
@marckohlbrugge interesting indeed. You got me thinking and you just gave me an idea for a simpler countless extra! I will try something ASAP. Stay tuned.
Domizio Demichelis
@ddnexus
@marckohlbrugge as promised I implemented a preliminary modification of the countless extra and doc that should allow you a super lazy and efficient mode. If you want to test it it is in the countless-lazyness branch. It's not tested yet. Please, let me know.
Domizio Demichelis
@ddnexus
New countless_minimal feature released as 4.11.0
Marc Köhlbrugge
@marckohlbrugge
@ddnexus Wow that's awesome. Thanks for adding this! Trying it right now
Marc Köhlbrugge
@marckohlbrugge

Okay seems to work really well! The only two gotchas I ran into are:

1) @pagy.next? no longer working. But it makes sense. I guess I was expecting it to just always return true, which would make it easier to migrate between the two countless modes. But I can also see how that might be confusing to some users. For now I just check if the current @posts is present. In which case I assume there will be another page. When we finally request a page where @posts is empty, then we won't render a next page link anymore.

2) @pagy.next to get the next page number didn't work anymore. So I had to create my own variable based on params[:page], defaulting to 1 if blank, and incrementing it. I feel like this could still be something Pagy could provide, even in the minimal mode.

Neither are a big issue tho

My average response time is now 23% faster 👌
https://buildinpublic.com if you're curious #shamelessplug
Marc Köhlbrugge
@marckohlbrugge
image.png
This is still very early data. As the cache warms up I expect the difference to be even bigger
Domizio Demichelis
@ddnexus

@pagy.next? no longer working

That never worked: that's not even a pagy method :)

@pagy.next to get the next page number didn't work anymore

Pagy variables are either known for certain or nil. Setting next to the next page (that is not known unless you query the DB) would violate that principle or defeat the purpose of the countless_minimal mode.

So I had to create my own variable based on params[:page], defaulting to 1 if blank

You don't need that: pagy does it for you. Just use @pagy.page.

My average response time is now 23% faster

HTH

Marc Köhlbrugge
@marckohlbrugge
Ah right. I was mistaken. I was checking for the presence of @pagy.next (not @pagy.next?)
@pagy.page is helpful to know. Thanks!
Nandu Rajagopala
@Nandu306
Hi there - I'm trying to style the bootstrap navbar generated by pagy (i.e. <%== pagy_bootstrap_nav(@pagy_a) %> ). I was wondering how this can be centered on a page. I've tried having this within a div and using class="justify-content-center" on it, but it doesn't work. Bootstrap uses the jcc class on the ul in order to style but how do I access it through this helper?
Domizio Demichelis
@ddnexus
Nandu Rajagopala
@Nandu306
ok, but how/where do we apply css styles to the pagy classes? where do i even find pagy classes? A bit more examples in the documentation would be helpful.
Domizio Demichelis
@ddnexus
just inspect the generated html in the browser, or inspect a template, or the helper
Nandu Rajagopala
@Nandu306
cool, thanks. fixed it.
Domizio Demichelis
@ddnexus
👍
Ben Koshy
@benkoshy
@Nandu306 you may style the classes, but perhaps something easier is to simply wrap the pay helper:
<div class="d-flex justify-content-center"> <%== pagy_bootstrap_nav(@pagy_a) %> </div> - i've been using something like this. you can even create a helper method to display the above if you want