feathers-pinia icon indicating copy to clipboard operation
feathers-pinia copied to clipboard

V4: Hybrid useFind only returns total and IDs but no items

Open dasantonym opened this issue 2 years ago • 6 comments

Using version 4.0.0 and Feathers 5.0.8 with WebSockets.

This is probably due to me using the module wrong, but I have a very simple situation that already does (almost) nothing:

const Space = useFeathersService('spaces')
const params = computed(() => ({ query: {} }))
const spaces$ = Space.useFind(params, { paginateOn: 'hybrid' })

Now the returned object spaces$ looks as follows:

spaces$.total -> 3
spaces$.data -> undefined
spaces$.currentQuery -> {
  ids: [...array containing 3 ids...],
  items: [],
  total: 3
}

Strangely it seems that it received the correct data since it has all three IDs that exist in this collection on the server, but I can't get it to give me the corresponding items. I tried spaces$.next(), awaited spaces$.request and called spaces$.find() but nothing seems to have any effect.

dasantonym avatar Aug 29 '23 21:08 dasantonym

Hmm... I'm trying to figure out what would cause this. Does your service have pagination enabled or is it returning a plain array?

marshallswain avatar Oct 24 '23 16:10 marshallswain

Hey @marshallswain, thanks for the response! This problem occurred with pagination enabled.

dasantonym avatar Nov 29 '23 14:11 dasantonym

Hello @marshallswain

First and foremost, thanks for working on this package. Secondly, please note that I am having the same exact issue as described by @dasantonym, except this issues happens in v4.1.1 as well. As mentioned, $messages.total has the correct results, however, the data object is empty.

Also, I set setupInstance for the messages service, logged the output and verified it is receiving and returning the data from the server, however, still no data is populated in the data object. The only way I was able to get useFind to work at all was to paginateOn: "server" however, this lacks the functionality needed for live updates.

palmtown avatar Dec 09 '23 23:12 palmtown

Note that I was able to trace my issue and opened https://github.com/marshallswain/feathers-pinia/issues/155 as it slightly differs from this issue.

palmtown avatar Dec 10 '23 07:12 palmtown

@palmtown and @dasantonym were you able to solve this? However, you might want to confirm that the id field returned from server matches that which is configured in your store setup i.e where you have you may have something similar to: defineStore({ idField: 'id', // Here clients: { api }, servicePath, Model: User })

lyricsking avatar Dec 25 '23 10:12 lyricsking