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
I've found an issue with using useFind. In short, when executing the code in Exhibit 1, feathers-pinia successfully queries my backend server which returns the results. However, the messages$.total variable shows the correct total, however, $messages.data is empty.
After debugging, I've found the issue and it is with the findInStore method that executes as part of the useFind function. In short, when I query using user=userId as shown in Exhibit 1, and on the backend I populate the user variable with the user's object, findInStore fails to find the data in the local store as user=userId doesn't match the returned data. In the returned data the user is now popluated with an object rather than a string (e.g. user={_id: "someid"...} opposed to user=userId).
Also, I tried altering the query with {query: {user: {_id: "some_id"}}, however, that doesn't work and findInStore is unable to match results using this query.
Note that this issue is similar to #142 however, in that issue, no parameters are passed in the query. Whereas in this issue, the problem is passing parameters to the query that changes on the backend due to populating the variable.
The text was updated successfully, but these errors were encountered:
I should document that useFind is only intended to work if your frontend and backend data structures match. There's no way to automatically configure two separate, custom data structures. In this case, you'll need to use service.find and service.findInStore manually.
Hello Community,
I've found an issue with using useFind. In short, when executing the code in Exhibit 1, feathers-pinia successfully queries my backend server which returns the results. However, the messages$.total variable shows the correct total, however, $messages.data is empty.
After debugging, I've found the issue and it is with the findInStore method that executes as part of the useFind function. In short, when I query using user=userId as shown in Exhibit 1, and on the backend I populate the user variable with the user's object, findInStore fails to find the data in the local store as user=userId doesn't match the returned data. In the returned data the user is now popluated with an object rather than a string (e.g. user={_id: "someid"...} opposed to user=userId).
Also, I tried altering the query with {query: {user: {_id: "some_id"}}, however, that doesn't work and findInStore is unable to match results using this query.
Any suggestions?
Exhibit 1
`
const { api } = useFeathers()
const params = computed(() => {
return { query: { user: props.userId } }
})
const messages$ = api.service('messages').useFind(params, { paginateOn: 'hybrid' })
`
Note that this issue is similar to #142 however, in that issue, no parameters are passed in the query. Whereas in this issue, the problem is passing parameters to the query that changes on the backend due to populating the variable.
The text was updated successfully, but these errors were encountered: