Restore server-error handling in the code app pages after #32 - #33
Open
TomProkop wants to merge 1 commit into
Open
Restore server-error handling in the code app pages after #32#33TomProkop wants to merge 1 commit into
TomProkop wants to merge 1 commit into
Conversation
PR #32 rewrote the Warehouse Picking code app's pages and dropped the if (!result.success) throw checks on every create/read call. Since the generated Dataverse services resolve an IOperationResult and never throw, every mutation's onSuccess fired unconditionally - including when ValidateWarehouseTransactionPlugin rejects an over-pick server-side, so the UI showed a success toast for a rejected transaction. Restores the explicit success checks, the Number() casts on Whole Number fields (quantity/availablequantity/capacity), the codeAppScaffolded idempotency guard in 05f-code-app.ps1, the refresh button's aria-label/testid, and the isLowStock indicator on the Available Qty columns.
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.
Follow-up to #32. Keeps the new page layout/structure from that PR (it's a real improvement — tighter
selectprojections, extra Status/Created columns, cleaner visual design) but restores a few things that got dropped along the way:Changes
if (!result.success) throw new Error(result.error?.message ?? ...)on every create/read call across all four pages (12 call sites). The generated Dataverse services resolve anIOperationResult<T>and never throw — without this check, every mutation'sonSuccessfired unconditionally, so picking more than the available quantity showed a "Transaction created" success toast even whenValidateWarehouseTransactionPluginrejected it server-side. This was the core scenario the code app was built to demonstrate.Number(...)casts on Whole Number fields (quantity,availablequantity,capacity) instead of sending raw strings — Dataverse's Web API expects real JSON numbers for these fields.codeAppScaffoldedidempotency guard in05f-code-app.ps1(Get-LabValue/Set-LabValue), matching every other scaffold script's convention — without it, re-running CP09 fails instead of skipping cleanly.aria-label="Refresh warehouse items"/data-testid="refresh-items"on the items page refresh button.isLowStock/LOW_STOCK_FALLBACKhelper inoptionSets.tsand wire it back into the Available Qty columns on the items list and item detail page, so the code app agrees with the model-driven grid on what counts as low stock.Testing
Docker/
dotnet/txcaren't available in this session, so I couldn't re-run the fullCP01-CP09pipeline this time. I verified each edited file parses as valid TSX/TS with the TypeScript compiler (ts.createSourceFile, checked for parse diagnostics) and manually re-checked everyresult.success/Number()call site against the generated service signatures established in #28. Please run the local dry-run (LOCAL-DRY-RUN.md) or a liveCP09-CP13pass before merging to confirmnpm run build/dotnet buildare clean and the over-pick scenario now correctly shows the plugin's rejection message instead of a false success toast.Generated by Claude Code