You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I've not misunderstood how this library works, I'm ready to provide with a PR!
The text was updated successfully, but these errors were encountered:
tanguilp
changed the title
Default fetch cursor value function fails base schema has the same field has the binding's
Default fetch cursor value function fails when base schema has the same field has the binding's
Aug 11, 2022
I have a cursor with 2 fields, one being a preload, something like:
[{:author, :name}, :name]
(let's say the base schema is:post
).I think the default fetch cursor value erroneously tries to fetch first the field on the base schema: https://github.com/duffelhq/paginator/blob/main/lib/paginator.ex#L243
As a result, if the base schema and the preloaded schema have the same field, then the wrong field from the base schema is used.
In the example above, that would result in the cursor having twice the post's name:
%{:id => 92575, :name => "Post's name", {:author, :name} => "Post's name"}
instead of
%{:id => 92575, :name => "Post's name", {:author, :name} => "Author's name"}
If I've not misunderstood how this library works, I'm ready to provide with a PR!
The text was updated successfully, but these errors were encountered: