-
Notifications
You must be signed in to change notification settings - Fork 93
LF-4987: New product not visible until load more clicked #3903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LF-4987: New product not visible until load more clicked #3903
Conversation
combine modal states and simplify onTileClick logic
| import { Product } from '../../store/api/types'; | ||
| import { TASK_TYPES } from '../../containers/Task/constants'; | ||
|
|
||
| const TABLE_MIN_ROWS = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Animal inventory we set it to totalInventoryCount. Is there a reason we want to limit to 20?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose 20 arbitrarily, but I thought it was reasonable.
When there are no products, totalInventoryCount is 0. After creating a new product, the "Load more" button appears because the number of rows to display is determined at render time based on totalInventoryCount, and it never updates dynamically.
In the Animal Inventory, totalInventoryCount doesn’t increase, so the button won’t appear unexpectedly. But in the Product Inventory, it can change, so we need a fixed number of rows. Should we set it higher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't update the inventory count dynamically to re-render. Then 20 is fine by me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, totalInventoryCount changes, but minRows determines the rowsPerPage in <Table /> at render time, and rowsPerPage can't be updated externally after that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a couple of inline comments. Functionally I think its all ok.
| }; | ||
|
|
||
| const [showPlantTaskModal, setShowPlantTaskModal] = useState(); | ||
| const [errorModal, setErrorModal] = useState(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Description
This PR fixes the title bug and adds missing pieces for the new product form feature:
minRowsto 20 to prevent showing the "Load more" buttonPureTaskTypeSelectionby combining states and simplifying logichasAvailableProductsSelectorJira link: https://lite-farm.atlassian.net/browse/LF-4987
Type of change
How Has This Been Tested?
Checklist:
pnpm i18nto help with this)