Repository navigation
fix(orders): keep the new order draft when a place is edited - #376
Merged
Merged
Conversation
Resetting in willTransition wiped the draft on any transition, including the refresh that follows saving a place, customer or facilitator from a modal. Reset in resetController only when exiting, and edit places from the route form without a refresh; re-preview the route and quote instead. Fixes fleetbase/fleetbase#651
This was referenced Oct 9, 2026
Open
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.
Fixes fleetbase/fleetbase#651. Supersedes #349.
On the new order form, saving a place from the pencil modal wiped every field already filled in. The same happened after creating a customer or facilitator from the header actions.
Root cause
OperationsOrdersIndexNewRoute.willTransition()calledcontroller.reset()on every transition, including an in-place refresh of the route itself.placeActions.modal.edit()saves with{ refresh: true }by default. So once Fix editing unsaved geocoded places in order form #307 let the place save succeed, the follow-uprouter.refresh()reset the draft.Changes
resetController(controller, isExiting), and only whenisExiting. This is Ember's hook for exactly this case: a refresh keeps the draft, and leaving the route still clears it. Unlike resetting inwillTransition, it also doesn't wipe the draft when a transition away is aborted.Order::Form::Route#editPlace: save withrefresh: false. The place record is edited in place, so the form already shows the change. The callback re-runs the route preview and requests a new service quote, since the location may have moved.Why not #349
willTransition()readstransitionwithout declaring it as a parameter, so it would throw aReferenceErroron every transition out of the route.Tests
tests/unit/routes/operations/orders/index/new-test.js: refresh keeps the draft; exiting resets it. Passes.tests/integration/components/order/form/route-test.js:editPlacesaves withrefresh: false, and the callback requests a quote refresh. Not yet run. Rendering tests in this file can't boot ember-intl in the local test browser, which also fails the file's three existing tests, and CI doesn't run Ember tests. Worth runningember test --filter "order/form/route"in Chrome before merging.