Skip to content
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

Transition retry with dynamic segments throws error #10972

Closed
novtor opened this issue Apr 28, 2015 · 10 comments
Closed

Transition retry with dynamic segments throws error #10972

novtor opened this issue Apr 28, 2015 · 10 comments

Comments

@novtor
Copy link

novtor commented Apr 28, 2015

When retrying a transition with dynamic segments an error is thrown:
You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route

My scenario:

  1. user goes on /songs?author='Ivan'
  2. then /songs/1?author='Ivan'
    And then reloads the entire page (with F5)
  3. On reloading my ApplicationRoute sees that the user is not logged on so it saves the current transition (songs/1?author='Ivan') and redirects to another route to log the user in. (similar as in http://guides.emberjs.com/v1.10.0/routing/preventing-and-retrying-transitions/)
  4. On login success, the transition (songs/1?author='Ivan') is retried and the error is thrown.

If user does only the first step and reloads the page, everything works fine

@workmanw
Copy link

I think this is related to my issue #10945. I'd bet author is a refreshModel param. If you temporarily remove the refreshModel config and retry, does it work?

@novtor
Copy link
Author

novtor commented Apr 29, 2015

Yes, that is it. Setting the author queryParams as refreshModel: false workarounds the issue. Thank you @workmanw

@novtor
Copy link
Author

novtor commented Jul 23, 2015

Looks like it has been fixed. Perhaps by the #11636. @workmanw please check also your #10945 if it is fixed?

@workmanw
Copy link

@novtor I checked in canary and my issues is still not working :( Here is an updated JSBin with Canary links. http://output.jsbin.com/lekegowuqu/1#/post/1/comments?search=awesome

EDIT: Here is a permant (non-annoymous) JSBin link: http://output.jsbin.com/humibo/1#/post/1/comments?search=awesome

@novtor
Copy link
Author

novtor commented Jul 30, 2015

You are right @workmanw , the bug persists, I was checking it on a route with refreshModel: false queryParams that's why it worked.
Looking forwrard on fixing it

@LexLythius
Copy link

In my case I was trying to retry an aborted transition, with identical results. Still not working with Ember 1.13.11.

My workaround for this has been:

this.transitionTo(URI_PATH_QUERY_AND_HASH_AS_STRING);

@erichaus
Copy link

@LexLythius could you give me a better example of your workaround? I ran into this error when calling this.refresh() inside a Route.actions.refresh action... not sure what's going on?!

@LexLythius
Copy link

@erichonkanen Simply, you have to build the target URL manually -- with all complexities involved. E.g.:

this.transitionTo("//yourdomain.com/#/some/path?query1=someValue&query2=another");

Useful pieces here are:

  • window.location -- this might be good enough for your workaround;
  • environment variables;
  • controllers' current path, for example this.container.lookup('controller:application').get('currentPath');
  • Route's paramsFor method and queryParams properties;
  • JS native encodeURIComponent function.

@erichaus
Copy link

@LexLythius ok awesome ill try that thanks!

@rwjblue
Copy link
Member

rwjblue commented Apr 14, 2016

Fix for #10945 was included in 2.4.4. This should have also been fixed.

@rwjblue rwjblue closed this as completed Apr 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants