marshallswain / feathers-pinia

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

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

Open dasantonym opened 1 year ago

dasantonym commented 1 year ago

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.

marshallswain commented 11 months ago

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

dasantonym commented 10 months ago

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

palmtown commented 10 months ago

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 commented 10 months ago

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.

lyricsking commented 9 months ago

@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 })