question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Usemany not populating relations no StrapiV4

See original GitHub issue

Describe the bug When you use useMany hook, metadata-> populate generate a proper URL

To Reproduce

use this code as template:

const { data: casosData, isLoading }: any = useMany<any>({
    resource: "casos",
    ids: [2, 3],
    metaData: {
      populate: ["pessoa_fisicas"],
    },
  });

It will make this request: http://127.0.0.1:1337/api/casos?filters[id][$in]=2&filters[id][$in]=3 I should make this request: http://127.0.0.1:1337/api/casos?filters[id][$in]=2&filters[id][$in]=3**&populate=pessoa_fisicas**

  • Used dataProvider: Strapi

Additional context I also tried with a Simple Rest API and it seems it wont work either.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
albcunhacommented, Jun 15, 2022

It was working. I mistook useOne for useMany on the real/original hook.

0reactions
omeraplakcommented, Jun 15, 2022

Uhmm I’ll check it tomorrow but I created requests for unit tests and it looked correct. Thank you!

https://github.com/pankod/refine/blob/next/packages/strapi-v4/test/dataProvider/index.mock.ts#L858

Read more comments on GitHub >

github_iconTop Results From Across the Web

v4 Creating relations with/populating users causes 500 #11847
When trying to populate relations on the User collection from the user-permission plugins returns a 500 with this error in console. [2021-12-08 ...
Read more >
Strapi v4, No relation fields in User collection types
I am trying to add some relation fields to my. User (collection types, default strapi collection). I created new collection types called ...
Read more >
Many-to-many query not populating relation - Strapi Backend
I've noticed that when creating a many-to-many relationship through the content manager UI, it creates two tables, e.g. shoes_sizes_links and ...
Read more >
Strapi Populate not working - Discussions
Hi all - I am struggling to find a solution for my API data. My design is that “Albums” have a one-to-many relationship...
Read more >
api/users endpoint is not sending relations and media fields
I just found the answer guys, there is a bug in the roles & permissions plugin related to population. There is an issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found