dataall
dataall copied to clipboard
Unable to view all environments in the environment list view
Describe the bug
After upgrading to 2.4 , user is unable to see environment more than 8 environments on the UI. The user can see that the RDS records have 9 environments and also can navigate to the environment which is not showing up by visiting the org->environment tab -> goto the environment.
The environment which is now showing up is in proper condition and the user has access to all the teams belonging to each environment
How to Reproduce
- Create 9 - 10 environments in data.all
- Check environment list UI for if the environment is showing
- 8 environments will be shown and only 1 page is shown
Expected behavior
All environments should be displayed
Your project
No response
Screenshots
No response
OS
Mac
Python version
3.9
AWS data.all version
2.4
Additional context
No response
Look into this issue and able to recreate the same behavior where the list Env is missing an environment, more specifically:
- 8 Envs --> All show on 1 page (Good)
- 9 Envs --> All show on 1 page (Good)
- 10 Envs --> 9 on 1 page and No Second Page (Error)
- 11 Envs --> 9 on 1 page and 2 on second page (Fine --> but page size should be 10)
Additionally with 10 Envs I looked at the listEnv
Query and I see the count returned in 10 but the number of nodes (i.e. # of envs) is only 9 -- to do some additionally digging here
After a bit more digging it looks like the origin of this issue is well summarized in this post
For the 10 Env Error case above:
After running the query as query.limit(page_size).offset((page - 1) * page_size).all()
in def paginate()
we are receiving back only 9 items and somehow losing 1 record in the process
One way to fix is to add a .distinct()
option to the Query which then seems to properly return all 10 items
However, a more general practice approach I think would be to add .order_by()
for any query that we want to paginate which also fixes the issue and ensures that the offset call when we get the next page does not return the same items as the previous page
cc: @dlpzx @SofiaSazonova @petrkalos- let me know your all thoughts too if you have time, will aim to open a PR tomorrow on this