marshallswain / feathers-pinia

Connect your Feathers API to the elegant data store for Vue
52 stars 22 forks source link

find() with paginateOn: 'server' has query ignored if no results returned #126

Open MajesticPotatoe opened 1 year ago

MajesticPotatoe commented 1 year ago

When using useFind() with { paginateOn: 'server' } and a query is performed via find() (destructured or service().find()) that returns empty results, data doesn't update. When this occurs, the find() query is ignored and will revert to displaying whatever the previous query results (essentially ignoring the query all together). This can be observed via pinia devtools. (queriedAt for the most recent pagination doesn't even update).

This also can be seen indirectly with { paginateOn: 'hybrid' } as well.

krislintigo commented 1 year ago

Yeah, noticed that too. I think the problem is here, when query is not tracked when total is 0 (found this in source code)

image
marshallswain commented 11 months ago

Thanks @MajesticPotatoe and @1sses. This looks like a legitimate bug. It will be a while before I can do anything to fix it, so this issue will remain open until I or someone else can come up with a solution.

MajesticPotatoe commented 11 months ago

no worries, pretty much my work around for the time being is to just clear store before query (not ideal but luckily it doesn't effect much for my use case)

marshallswain commented 11 months ago

I'm going to update that conditional to see if it fixes our problem. It's a quick and dirty fix, since I didn't specifically update tests for it. I've just fixed the conditional in feathers-pinia@3.0.6. Please try it out to see if it fixes the issue you're facing. Thanks again for reporting!

marshallswain commented 11 months ago

I'm reverting the change. Integrating into a published app fails. I'll work on this another time.