Skip to content
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

Open
wants to merge 4 commits into
base: integration
Choose a base branch
from

Conversation

den4ik1203
Copy link
Collaborator

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

  • [+] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • Passes test case
  • [+] UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • [+] I have commented my code, particularly in hard-to-understand areas
  • [+] My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • [+] The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@den4ik1203 den4ik1203 requested review from a team as code owners May 24, 2024 16:40
@den4ik1203 den4ik1203 requested review from Duncan-Brain and kathyavini and removed request for a team May 24, 2024 16:40

return (
<HookFormPersistProvider>
<PureCompleteStepOne
key={products.length} // Adding key prop to force re-render
Copy link
Collaborator

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.

@SayakaOno SayakaOno removed the request for review from kathyavini May 24, 2024 17:07
import { setPersistedPaths } from '../../hooks/useHookFormPersist/hookFormPersistSlice';
import { getProducts } from '../saga';

function generateProductsKey(products) {
return products.map((product) => `${product.product_id}-${product.supplier}`).join('-');
Copy link
Collaborator

@SayakaOno SayakaOno May 24, 2024

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!

@kathyavini kathyavini added the bug Something isn't working label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants