Hi team,
Working again on improving the performances of Forest admin, I have noticed useless additional requests that have a great impact, when managing many to many relations.
Here is my many to many relations:
db.devices.belongsToMany(db.t_users,
{
as: 'users',
through: db.vusers_to_devices,
foreignKey: 'device_id',
otherKey: 'user_id',
});
db.users.belongsToMany(db.devices,
{
// as:'devices',
through: db.vusers_to_devices,
foreignKey: 'user_id',
otherKey: 'device_id',
});
The navigation in Forestadmin:
- display users list
- access one user => displays the Summary view (beginning of the video below)
- the
Devices
association appears in related data section - Click on
Devices
displays the devices associated to the user.
=> No problem - click on one
Device
entry
=> Problem: Forest admin is generating requests to access the users (the parent relation).
Please have a look at this video
Displaying the details of one device entry should not generate the requests to display the list of the parent users.
Please note that this problem does not occur when navigating directly from the devices
collection as the initial list.
My current setup:
"database_type": "postgres",
"liana": "forest-express-sequelize",
"liana_version": "6.6.0",
"engine": "nodejs",
"engine_version": "12.13.1",
"orm_version": "5.22.3"