Hi Forest Admin team,
I am facing duplicate user issues on the forest Admin UI due to some relationships if I add an Expense and Merchant it creates multiple duplicate users in the user table. Please look into the shared SS.
Please help me out with this problem.
Thanks for sharing those pieces of information. From an external point of view it like the /users route returns multiple times the same user, I wonder if the issue can come from a malformed request to your DB (missing groupBy clause for example that could explain why you have multiple time the same row).
Can you share the network call payload for the /users route? This can be really useful to validate my assumption.
Can you try running your back with an additional environment variable DEBUG=sequelize:sql* ? It will display the SQL queries done for each request. So you can share the SQL request made when you navigate to users view.
I’m looking forward to hearing from you again with your responses.
Looking at your logs, I saw relations to child_physical_details and child_education_information but it doesn’t appear in the relationship you have shared.
Our assumption is that one of your relationships is a malformed oneToMany (something like hasMany + hasOne that cause issues in Sequelize instead of hasMany/belongsTo). In this case, a LEFT JOIN could explain duplicated records.
You can hide all the fields (except username) in the UI, then put them one by one. This way we might have more information on the field that triggers the issue.
Hi @morganperre can we connect over a meeting to better understand the issue? The user table is quite complex and has a lot of relations, I had shared the relations that I suspected to have the problem.
I can share the complete .forestadmin.schema.json if you want.
Hi, @morganperre tried hiding all the fields and kept the email field and there were no duplicates.
Then I unhide the Expense last modified by then I got 4 duplicates. Similarly got 2 duplicates with merchant_details.
I have removed all the “hasOne” and “hasMany” relations from the Users table which are not there in the Database and kept only the “belongsTo” relations in the other tables which belong to the users table. Now It’s working fine.