Skip to content

OBPIH-7183 Fix Receiving quantities disappear after edit - if hand typed#5638

Merged
alannadolny merged 1 commit intorelease/0.9.6-hotfix1from
bug/OBPIH-7183
Nov 25, 2025
Merged

OBPIH-7183 Fix Receiving quantities disappear after edit - if hand typed#5638
alannadolny merged 1 commit intorelease/0.9.6-hotfix1from
bug/OBPIH-7183

Conversation

@SebastianLib
Copy link
Collaborator

✨ Description of Change

Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-7183

Description:


📷 Screenshots & Recordings (optional)

@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Nov 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug (OBPIH-7183) where receiving quantities would disappear after editing if they were hand-typed. The root cause was that the saveEditLine method was reading from stale component state (this.state.values) instead of using the current form values (formValues) passed from React Final Form.

Key changes:

  • Updated saveEditLine to use formValues parameter consistently throughout the method
  • Ensures hand-typed quantities are preserved during the save operation
  • Maintains data consistency between the form state and component state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

*/
saveEditLine(editLines, parentIndex, formValues, rowIndex) {
const { containers } = this.state.values;
const { containers } = formValues;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we used this.state.values to get container data, which was stale when user hand typed values (quantityReceiving). We should get data from formValues instead, which is already passed to this function and contains the current form state.

The saveEditLine function is only called from EditLineModal.jsx:

  save(values) {
    this.state.attr.saveEditLine(
      values.lines,
      this.state.attr.parentIndex,
      this.props.values,
      this.props.rowIndex,
    );
  }

Alternative we can update this.state.values on onChange or onBlur, but I think the best option is just use fresh data from formValues

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/0.9.6-hotfix1@0703bea). Learn more about missing BASE report.

Additional details and impacted files
@@                   Coverage Diff                   @@
##             release/0.9.6-hotfix1   #5638   +/-   ##
=======================================================
  Coverage                         ?   8.52%           
  Complexity                       ?    1127           
=======================================================
  Files                            ?     712           
  Lines                            ?   45648           
  Branches                         ?   10911           
=======================================================
  Hits                             ?    3890           
  Misses                           ?   41179           
  Partials                         ?     579           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alannadolny alannadolny merged commit cd19ad5 into release/0.9.6-hotfix1 Nov 25, 2025
13 checks passed
@alannadolny alannadolny deleted the bug/OBPIH-7183 branch November 25, 2025 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants