msupply-foundation / open-msupply

Open mSupply represents our most recent advancement in the Logistics Management Information System (LMIS), expanding on more than two decades of development inherited from the well-established legacy of the original mSupply.
https://msupply.foundation/open-msupply/
Other
23 stars 14 forks source link

Fix useEffect usage in Discount #4750

Open jmbrunskill opened 2 months ago

jmbrunskill commented 2 months ago

I think we would need to fix the dependencies to useEffect in discount, although kind of hard to judge if that useEffect will run more then once, and ideally it's all should be done with 'await' rather then other hooks and dependencies. But that's for another issue/PR

Originally posted by @andreievg in https://github.com/msupply-foundation/open-msupply/pull/4749#pullrequestreview-2284459562

andreievg commented 1 month ago

Also would prefer if defaultPricing passed to createDraftStockOutLineFromStockLine is not optional https://github.com/msupply-foundation/open-msupply/blob/e98a73c8b2db764928ad11e0c519b83a2efbe11f/client/packages/invoices/src/StockOut/utils.tsx#L49-L62

andreievg commented 1 month ago

Also back end to return non optional fields ItemPriceNode

andreievg commented 1 month ago

@jmbrunskill I think this was fixed in the clean up issue/pr ?

jmbrunskill commented 1 month ago

@jmbrunskill I think this was fixed in the clean up issue/pr ?

Yes, although it's still an optional, so I wasn't sure if you wanted to keep this open. The useEffect should be correct now...