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

Fix data and queryParameters not being reset when route becomes inactive #210

Closed
wants to merge 2 commits into from

Conversation

leolabs
Copy link

@leolabs leolabs commented Aug 9, 2017

Should fix #206

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@leolabs
Copy link
Author

leolabs commented Aug 9, 2017

I signed the CLA!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Aug 9, 2017
@alber70g
Copy link

alber70g commented Aug 9, 2017

I think you should change your tabsize to 2 spaces instead of 4. Also, the tests are failing

@NeoLegends
Copy link

NeoLegends commented Aug 9, 2017

Tests are obviously the issue right now (adapting them is not), especially since it seems like the expected behavior of the element is to remain how it is if it isn't active. Maybe someone from the polymer elements team can shine some more light on this.

@bashmish
Copy link

bashmish commented Oct 2, 2017

I checked this approach in my setup with three levels of navigation (/:modelName/:id/:subsection) and three corresponding app-route connected with tail="subroute" approach. It didn't work because the moment when app-route becomes inactive is different than you expected. Imagine you have such transitions:

  1. /my-model/1/subsection => /my-model (user wants to see the list of items again)
  2. /my-model=> /my-model/1 (user chooses this item again)
  3. /my-model/1 => /my-model/1/my-subsection (same subsection is open again)

The app-route for /my-model/1/my-subsection (last in the chain) becomes inactive in the transition 3, but not 1 as you expect. And right afterwards becomes active again. So if you rely in the template on its routeData, it will be updated only in transition 3 when it is not needed anymore, because it gets new params (:id and :subsection) right away as same path is activated :(

@e111077 e111077 self-requested a review April 17, 2018 16:27
@e111077
Copy link
Contributor

e111077 commented Apr 17, 2018

This was a feature intentionally reverted while in beta because of computational cost. It would propagate down the entire routing subtree upon each change.

Seeing as there has been repeated requests for this feature, I'd be willing to merge a non-breaking change that hides this feature behind a flag (name I have made up below is crude and I welcome suggestions), so usage would be

<app-route clear-data-on-reset route="{{route}}" data="{{firstDataClearsOnReset}}" tail="{{tail}}">
</app-route>
<app-route clear-data-on-reset route="{{tail}}" data="{{secondDataClearsOnReset}}">
</app-route>

@e111077
Copy link
Contributor

e111077 commented Apr 17, 2018

Closing for now since this has gone stale. Reopen with changes if you wish to go this route

@e111077 e111077 closed this Apr 17, 2018
@jsilvermist
Copy link

I would love this feature, if it has to be a flag, that sounds fine to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Property "data" doesn't change when the route isn't active
7 participants