.paginate combined with .withIndex is causing an error
All the code below could be better arranged, but this is for the simplicity of the example:
Let's say I want to display all the posts from the city of the user, so this is how I achieve it:
The problem is that when a user change his city by patching his data, the
getPostForUser function returns an error:Uncaught Error: InvalidCursor: Tried to run a query starting from a cursor, but it looks like this cursor is from a different query.I think this happens because the args haven't changed but the result has, given it has been retriggered by the inner data change from the user table.
A way to circumvent this would be to instead pass the city of the user as an argument of the function, so the query result changes when the args change.
However, I would like to improve the ergonomics here: I feel that the code above looks good and it is unfortunate not being able to rely on a table for a paginated query. I don't think it makes sense this function returns an error conceptually.
