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.

[Bug] Error when transitioning to a route with QPs

See original GitHub issue

🐞 Describe the Bug

I am transitioning to a route that has a :name in the url and also QPs. This transition can be slow. If, while the transition is still taking place, I try to transition to the same route with different QPs, I get the following error.

Error: You must provide param `name` to `generate`.
    at getParam (route-recognizer.js:137)
    at Array.generate.<computed> (route-recognizer.js:183)
    at RouteRecognizer.generate$1 [as generate] (route-recognizer.js:553)
    at PrivateRouter._updateURL (router_js.js:1651)
    at router_js.js:1250
    at invokeCallback (rsvp.js:485)
    at rsvp.js:546
    at rsvp.js:14
    at invokeWithOnError (backburner.js:272)
    at Queue.flush (backburner.js:182)

🔬 Minimal Reproduction

TODO

😕 Actual Behavior

My theory is that the router is trying to update the QPs on the current route, not the future one. In the above example, if I pause where the error is thrown, I can see that params are the params of the current route, not the future one.

🤔 Expected Behavior

This doesn’t raise an error.

🌍 Environment

  • Ember: 3.25.3
  • Node.js/npm: 14.15.1
  • OS: macOS 11.2.3
  • Browser: Chrome 91.0.4449.6

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sly7-7commented, Mar 29, 2021

@wagenet I tried to write a test to reproduce you use case, but it fails with an other error.

async ['@test repro 19483'](assert) {
      assert.expect(1);
      this.application.LOG_TRANSITIONS = true;
      this.application.LOG_TRANSITIONS_INTERNAL = true;
      this.addTemplate('application', '{{outlet}}');
      this.addTemplate('posts', '{{outlet}}');

      this.router.map(function () {
        this.route('posts');
      });

      //this.add('route:application_loading', Route.extend());

      this.add(
        'route:posts',
        Route.extend({
          model(params, transition) {
            return new Promise((resolve) => {
              if (transition.to.queryParams.a === '42') {
                later(this, resolve, 1000);
              } else {
                assert.ok(true);
                resolve();
              }
            });
          },
        })
      );

      this.visit('/posts?a=42');
      await this.visit('/posts?a=45');
    }
Source: | TypeError: Cannot read property 'name' of undefined     at Class._queryParamsFor (http://localhost:4200/tests/ember.js:22157:59)     at Class.finalizeQueryParamChange (http://localhost:4200/tests/ember.js:21106:29)     at Class.triggerEvent (http://localhost:4200/tests/ember.js:22616:27)     at PrivateRouter.triggerEvent (http://localhost:4200/tests/ember.js:21466:43)     at PrivateRouter.finalizeQueryParamChange (http://localhost:4200/tests/ember.js:66003:12)     at PrivateRouter.queryParamsTransition (http://localhost:4200/tests/ember.js:65498:37)     at PrivateRouter.getTransitionByIntent (http://localhost:4200/tests/ember.js:65570:37)     at PrivateRouter.transitionByIntent (http://localhost:4200/tests/ember.js:65519:21)     at PrivateRouter.doTransition (http://localhost:4200/tests/ember.js:65655:19)     at PrivateRouter.handleURL (http://localhost:4200/tests/ember.js:66111:19)
-- | --

So I don’t know if this is the exact reproduction, but anyway… this is bad 😦

0reactions
lvegeranocommented, Apr 9, 2021

Look for bugs labeled QueryParams, this issue has been lurking circa 2015.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing query params in transitionTo doesn't seem work
I am in my application route and have query-params defined in its ... or do the console error messages indicate some kind of...
Read more >
Navigator 2.0 Route Transition Bug - flutter - Stack Overflow
I am stuck with a bugged animation when I try to set a Navigator 2.0 on part of the screen. My App Layout...
Read more >
Optimization Guide | Google Maps Platform
This guide describes several strategies to optimize your Google Maps APIs usage in terms of security, performance, and consumption.
Read more >
AWS resources that you can send Resolver query logs to
If you expect to log queries for workloads with high queries per second (QPS), you should use Amazon S3 to ensure your query...
Read more >
Qinsy 9.2.0 - Resolved Bugs - QPS Confluence
Bug Fixes. Below you will find listings of bugs which have been reported in previous releases and which have been solved for the...
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