fix(lazyLoad): abort URL-sourced transition when its target was replaced by the lazy load#2
Closed
simshanith wants to merge 1 commit into
Closed
fix(lazyLoad): abort URL-sourced transition when its target was replaced by the lazy load#2simshanith wants to merge 1 commit into
simshanith wants to merge 1 commit into
Conversation
…ced by the lazy load When a URL matches a future state's prefix but nothing in the lazy loaded module matches the full URL, retryTransition() delegates to urlService.sync() but returned undefined, letting the original transition resume and activate the deregistered .** placeholder, superseding the otherwise() transition started by sync(). After delegating to sync(), check whether the original transition's target state is still registered; if the lazy load replaced it (e.g. a .** placeholder), abort the original transition so the sync()-initiated transition (e.g. the otherwise() rule) can complete. Closes ui-router#850
Owner
Author
|
closing in favor of #1 / ui-router#851 |
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
Alternative (stricter) fix for ui-router#850 — companion to the unconditional-abort PR #1; pick one.
Same bug: when a URL matches a future state's prefix but nothing in the lazy-loaded module matches the full URL, the original URL-sourced transition resumed after
urlService.sync()and activated the already-deregistered.**placeholder, superseding theotherwise()transition started bysync().Fix
In
retryTransition()(src/hooks/lazyLoad.ts), after delegating tosync(), abort the original transition only if its target state is no longer in the registry (i.e. the lazy load replaced the.**placeholder). If the target somehow survives the lazy load (e.g. the module registered unrelated states), existing fall-through behavior is preserved.Trade-off vs the primary fix
return falseunconditionally): simpler; any URL-sourced transition that falls through tosync()is aborted —sync()re-derives the correct destination either way.Tests
Same two regression tests as the primary PR (both fail on master, pass here):
.**future state but matches nothing in the loaded module activates theotherwise()rule's stateRejectType.ABORTEDFull suite: 587/590 pass (3 pre-existing skips), same as master baseline.
Closes ui-router#850