Watch and compare route before re-invoking fetch()
in ResourceDetail
#12278
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
This resolves an issue that was preventing the detail page from rendering. #12237 introduced a change that would prevent errors from being thrown if
fetch()
was invoked against a route without any keys in its query - a use case that was required for navigating between tabs in edit views.This fix attempts to address a change in timing between route watchers and component unmounting by slightly modifying the approach taken in #12237 by watching the route and only allowing
fetch()
to re-invoke if the route hasn't changed. The differences observed appear to be related to:Fixes #12267
Fixes #12275
Occurred changes and/or fixed issues
$route
instead of$route.query
in ResourceDetail$route.name
hasn't changed before invokingfetch()
Areas or cases that should be tested
This modifies
fetch()
behavior for all edit components. Navigation between edit pages and tabs needs to be tested.Areas which could experience regressions
Navigation and data fetching for edit components.
Checklist