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

Recompute href based on router.currentState #132

Merged
merged 1 commit into from
Aug 6, 2020

Conversation

jordpo
Copy link
Contributor

@jordpo jordpo commented Jul 29, 2020

This closes #131

}
},

routerCurrentStateChange: observer('router.currentState', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we already access the "service:-routing" in hrefTo, perhaps we might be able to use something in it? If so, we could avoid another lookup and use a higher level primitive. Perhaps https://api.emberjs.com/ember/release/classes/RouterService/events/routeDidChange might be useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially tried using the event but the version of ember that the add on is using doesn't have the router service events.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, we're currently running "ember-source": "~3.4.8" which is quite old. We should likely upgrade and support whatever version introduced the routing service

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want that as part of this PR? I can add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, thanks for offering. Perhaps in another PR which we can land first before this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Just a heads up I'm not going to get to this till probably Monday next week.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also as part of the update, want me to refactor using Octane patterns?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is the update PR #133

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebased with update and added looking at the router routeDidChange event. I still needed a separate getter for the router service vs the routing service. the former has the event handling and the latter has the generateURL method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, 3.6 seems to have introduced routeDidChange

});

await settled();
assert.equal($('#link-to-links a:contains(About)').attr('href'), '/about?section=two')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps it would be useful to also test the behaviour of <LinkTo> alongside {{href-to}} to ensure that they have the same behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree and will add once I iterate post Ember update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and updated

@jordpo
Copy link
Contributor Author

jordpo commented Aug 4, 2020

@GavinJoyce this should be good to go now

Copy link
Contributor

@GavinJoyce GavinJoyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work, thanks!

@GavinJoyce GavinJoyce merged commit c97e829 into intercom:master Aug 6, 2020
@jordpo jordpo deleted the recompute branch August 6, 2020 14:26
@GavinJoyce GavinJoyce mentioned this pull request Aug 6, 2020
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

Successfully merging this pull request may close these issues.

href-to helper doesn't recompute when query params change
2 participants