[Shopify] Persist current B2B Catalog row before disabling Sync Prices on other lines#8211
Open
onbuyuka wants to merge 1 commit into
Open
[Shopify] Persist current B2B Catalog row before disabling Sync Prices on other lines#8211onbuyuka wants to merge 1 commit into
onbuyuka wants to merge 1 commit into
Conversation
…s on other lines
When the user enables `Sync Prices` on a B2B Catalog row whose catalog ID
is already in use on another company row and clicks `Yes` on the
confirmation dialog, the current row's toggle was being lost. The OnValidate
trigger called `OtherCatalog.ModifyAll("Sync Prices", false)` against the
same table before the page had a chance to persist the user's change on the
current row. The resulting client refresh re-read the current row from the
database (still `Sync Prices = false`), clobbering the in-memory `true`.
Persist the current Rec with `Modify()` before the `ModifyAll` on the
other rows so the database already reflects the user's intent if the page
refreshes.
Also strengthen `SyncPricesConfirmDisablesOtherLine` to re-read Catalog2
from the database (mirroring the existing pattern used for Catalog1) so the
test would catch this regression.
Fixes AB#630273
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Modify() skips OnModify trigger for current recordCalling Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reactivation of bug 630273. PR #7585 introduced a confirmation dialog for the
Sync Pricestoggle on B2B Catalog rows that share a catalog ID across multiple companies. PM testing showed that when the user clicked Yes on the dialog, the toggle was lost on the current row too — not just the other line — so nothing ended up with Sync Prices enabled.Root cause
"Sync Prices"OnValidate calledOtherCatalog.ModifyAll("Sync Prices", false)while the user's changeRec."Sync Prices" := truewas still only in memory. The client refresh that follows theModifyAllre-read the current row from the database (stillfalse), clobbering the in-memorytrue.The existing
SyncPricesConfirmDisablesOtherLinetest asserted the in-memory value of the current row afterValidate+Modify(true), so it passed even though the persisted state was wrong.Fix
Persist the current row with
Modify()before theModifyAllon other rows. This way the database already reflects the user's intent if the page refreshes.Test plan
SyncPricesConfirmDisablesOtherLineto re-read Catalog2 from the database (mirroring the existing pattern used for Catalog1 in the same test) so the regression would be caught next time.SyncPricesCancelKeepsBothUnchanged— unchanged, still passes.SyncPricesNoConfirmWhenNoDuplicate— unchanged, still passes.Fixes AB#630273