-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RouteQueryManager doesn't play nice with loading substate #67
Comments
This is a similar edge case to the one encountered by @viniciussbs during development of RouteQueryManager: #20 (comment) |
I think I have a solution in mind for this, however it might be blocked by an Ember bug. This line in However, this appears to be flawed when using loading substates, because Ember treats those as an actual route transition in that The problem with this is that that's not what actually happens with Might not be able to fix this issue until that's fixed, unless somebody comes up with a better solution. If we can get confirmation that that's indeed a bug, we should actually be able to make these changes ahead of time and just have loading routes continue to malfunction (the same as they are today) until the Ember bug is fixed. |
@villander Could to talk to @locks to check this possible bug in Ember? |
Yes this is the bug, we can either wait for this bug to be resolved or send a PR to Ember.js |
So I totally misunderstood that Ember issue and I don't think it's related. I guess it's expected behavior that if you transition from This is problematic for the design of the Still searching for a solution to this. |
@bgentry From my testing it seems like the transition is undefined when making a transition to the same route (changing between substates like loading, or via query params). To bypass this issue, I'm overriding the resetController(_controller, isExiting, transition) {
if (isExiting && transition && transition.targetName !== 'error') {
this.get('apollo').unsubscribeAll();
}
}, |
I never updated this thread, but I did speak to @rwjblue about this at one point. He said there was really no workaround or fix for this other than to not use loading substates. |
I have a route in my app called
widgets.show
that takes an ID param. I tried adding a loading substate to my app with a template namedshow-loading.hbs
. Once I add this template and I transition between showing different widgets (updating the:id
route param from i.e.1
to2
), the following sequence of events happens:beforeModel()
is called on thewidgets.show
route for the new ID2
. This causes theRouteQueryManager
to mark all preexisting watch query subscriptions as stale, which is good. In this case, it's only the query for widget with ID1
that is active and thus marked stale.model()
gets called with the new ID2
, initiating the Apollo Client request and starting a subscription which is not stale.resetController()
is called on thewidgets.show
route withisExiting=true
. TheRouteQueryManager
then unsubscribes to all queries, which includes the pending query for the new widget. Thetransition
argument toresetController()
isnull
.The problem here is that
RouteQueryManager
usesisExiting
to determine whether it should unsubscribe to all queries, or just those that were previously marked as stale. With a loading route, the previouswidgets.show
route is exited in favor ofwidgets.show_loading
. If I remove the loading template,isExiting
remains false and only the stale queries are removed.I'm not sure right now how to solve this. Any ideas?
The text was updated successfully, but these errors were encountered: