Replies: 5 comments 1 reply
-
@Darkyn any resolution to this outside of this discussion? I am seeing the same thing, getPageItems() of my custom cursor paginator being called twice per request |
Beta Was this translation helpful? Give feedback.
-
Hey @jbraband sorry for the late reply! I can see roughly what's causing this, but I can't see a clean way around it so I'm just living with it at the moment. I will likely revisit this in the future though, so I'll let you know if I discover anything useful. |
Beta Was this translation helpful? Give feedback.
-
Hey Both, I'm having the same issue - and found this while looking for a fix. I'll also try and get round to digging down a bit if I can. |
Beta Was this translation helpful? Give feedback.
-
Ah, it's a fairly simple cause - And then calls it again to get the actual items when you need them. I think the fix would be for the core plugin to cache the items itself - possibly on the Request object itself? Just a thought. WorkaroundAs a workaround I've added my own little cache. I've used the objectID from the request as the cache key, so as long as the exact same Request object is passed it will use the cache. You could use a simpler
|
Beta Was this translation helpful? Give feedback.
-
while not appropriate for all cases, I can confirm that enabling caching on the connector or request does indeed result in the request being fired once in the paginator. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
I have a paginator that overrides Paginator->getPageItems(), and I've noticed that it's being called twice on each request. If I look in Paginator.php I can see it's being called on line 114 and line 254. This results in the getPageItems method being called twice on my paginator class.
I'm just wondering if this is expected behavior or if I'm possibly doing something wrong. Ideally it would only ever be called once on each request, to get the items for the current page.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions