Duplicate Rows in forest admin UI

Hi, I have been testing forest admin for a while and decided to use it with a a postgres datasource.

I createad a sql view in my database and use the docs to integrate that view in my admin manage sql views.
Then i did some testing and I’m getting results in my forest admin UI. The problem is that in the UI when doing some searchs or applying some filters to my data, I get duplicated rows, but the UI is receiving the correct data (saw the request response in chrome network tab) . I will add some images to make myself clear.

In the above screenshot we can see that forest admin is showing 2 records but the second row is a duplicated row of the first one, In the network manager we can see the result of the request, inside data, 2 records are returned but this 2 records are different one with balance 1.42 and the other one with balance 995, which is the correct behavior. Seems to me that forest admin for some reason is rendering n times (based on response length ) only the second record. Also when accessing the record I get thee content of the first record in data, the one with 1.42 not the selected one of 995.

Here is a screenshot of the request headers page

Preformatted text

Expected behavior

Show in the admin the rows returned by forest admin server

Actual behavior

Only 1 row is rendered, and the other ones are duplicated of the first one (number of duplicate is based on the length of the response data array)

Failure Logs

When quering the view this is the query that is being run in the server forest admin

Executing (default): SELECT count(*) AS “count” FROM “public”.“user_budgets” AS “user_budgets” WHERE (lower(“user_budgets”.“name”) LIKE lower(’%szhao@aa054efeac.com%’) OR lower(“user_budgets”.“email”) LIKE lower(’%szhao@aa054efeac.com%’) OR lower(“user_budgets”.“type”) LIKE lower(’%szhao@aa054efeac.com%’) OR lower(“user_budgets”.“group_name”) LIKE lower(’%szhao@aa054efeac.com%’) OR lower(“user_budgets”.“currency”) LIKE lower(’%szhao@aa054efeac.com%’));

The request to the server admin is
OPTIONS /forest/user_budgets/count?fields%5Buser_budgets%5D=balance%2Ccurrency%2Cemail%2CgroupName%2Cname%2Ctype%2CuserId&search=szhao%40aa054efeac.com&searchExtended=0
Please include any relevant log snippets, if necessary.


I follow the docker installation steps, so my app is run inside a container, but I’m able to do CRUD operation with my data inside the forest admin UI

  • Package Version: forest-express-sequelize 7.11.2
  • Express Version: 4.17.1
  • Sequelize Version: 5.22.0
  • Database Dialect: postgresql
  • Database Version: 9.6
  • Project Name: Sunlight-prod

Hello @cris2123 :wave: and welcome to the Forest Admin community! :tada:

It looks like your data have the same id aa054efeac.
This won’t work and produce this behaviour.
Do you know why your records share the same id?
Could you do something about this?

Let me know :wink:

Hi @Guillaume_Cisco, Thank you for your response. My data comes with the same Id because I’m using a sql union and multiple joins to get 2 types of records from different tables in one table but their share the same user id which I’m using as primary key, from what you tell me this is invalid, so if I use another field as primary key and it is unique the problem could be solved right?

Yes, if you use another field as primary key which will produce different ids, it should be fine :smiley:

Thank for your support :smiley:, it work’s perfect. Thank you again.

1 Like