question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RouteQueryManager doesn't play nice with loading substate

See original GitHub issue

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 named show-loading.hbs. Once I add this template and I transition between showing different widgets (updating the :id route param from i.e. 1 to 2), the following sequence of events happens:

  1. beforeModel() is called on the widgets.show route for the new ID 2. This causes the RouteQueryManager to mark all preexisting watch query subscriptions as stale, which is good. In this case, it’s only the query for widget with ID 1 that is active and thus marked stale.
  2. model() gets called with the new ID 2, initiating the Apollo Client request and starting a subscription which is not stale.
  3. resetController() is called on the widgets.show route with isExiting=true. The RouteQueryManager then unsubscribes to all queries, which includes the pending query for the new widget. The transition argument to resetController() is null.
  4. The new widget route never leaves the loading state because its promise is never resolved (due to the subscription being unsubscribed).

The problem here is that RouteQueryManager uses isExiting to determine whether it should unsubscribe to all queries, or just those that were previously marked as stale. With a loading route, the previous widgets.show route is exited in favor of widgets.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?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
viniciussbscommented, Oct 31, 2017

@villander Could to talk to @locks to check this possible bug in Ember?

0reactions
bgentrycommented, Mar 22, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Router query object not immediately populated from dynamic ...
Bug report The router query object is not populated immediately from dynamic route params on either the server or the client.
Read more >
Angular router navigate doesn't load page when query ...
'reload' : The router reloads the URL. Use to implement a "refresh" feature. In the main app routing file, set the value to...
Read more >
How to build a custom blockchain implementation in Rust ...
This tutorial demonstrates how to implement a very basic, backend-based, custom blockchain application in Rust using Substrate.
Read more >
Cisco's Enhanced Interior Gateway Routing Protocol (EIGRP)
When a QUERY is received for a route that doesn't exist in our topology ... met for the EIGRP reliable transport protocol to...
Read more >
IColor ProRIP Software Instruction Manual
It is expected that the print mode corresponds to the loaded material or media. Substrate Color - This is the background color used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found