-
Notifications
You must be signed in to change notification settings - Fork 78
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
This change will show the created product during the completion of a Soil Amendment, Clean or Pest Contol task. #3211
base: integration
Are you sure you want to change the base?
Conversation
|
||
return ( | ||
<HookFormPersistProvider> | ||
<PureCompleteStepOne | ||
key={products.length} // Adding key prop to force re-render |
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 think this is a good solution, but if you add an existing product and then modify its supplier, the change in supplier will not be reflected on the completion page.
import { setPersistedPaths } from '../../hooks/useHookFormPersist/hookFormPersistSlice'; | ||
import { getProducts } from '../saga'; | ||
|
||
function generateProductsKey(products) { | ||
return products.map((product) => `${product.product_id}-${product.supplier}`).join('-'); |
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 don't think this solution is maintainable or scalable. We would need to update this function every time a new field is added, like NPK.
One way to go about it is to include all fields in the key using Object.values(product).join('-');
, but the key will be very long. I would suggest you go in a different direction.
We can discuss this in dev standup next week!
@SayakaOno @Duncan-Brain does this one need to be re-reviewed, or is it stale? |
As Denis mentioned in the commit message, the solution isn't ideal. @den4ik1203 What do you think? |
I don't believe that I would be able to propose any other solution, maybe you can explain me how it should be done? @SayakaOno @antsgar |
Maybe someone could implement a solution, and Denis can learn from it? |
Description
This change will show the created product during the completion of a Soil Amendment, Clean or Pest Contol task.
Jira link: https://lite-farm.atlassian.net/browse/LF-4228
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: