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: Subfolder sites rewriting URLs to root domain on initial load #8932

Merged
merged 2 commits into from Feb 12, 2020

Conversation

davidtaylorhq
Copy link
Member

The DiscourseLocation.initState function was renamed in 0431942 (select-kit-2) to initOptions. This means that the ember router does not automatically call the function after the router is initialized.

For a long time, we have been calling the initState function in the init() function of discourse-location, which caused an imperceptible URL change to the the root domain, before switching back to the correct subfolder URL when ember called initState. This commit removes that call from the initializer, so initState is only called once (by ember).

Relevant ember code: https://github.com/emberjs/ember.js/blob/v3.12.2/packages/@ember/-internals/routing/lib/system/router.ts#L695-L699

Context at https://meta.discourse.org/t/recent-changes-breaking-subfolder-setup/141232

The DiscourseLocation.initState function was renamed in 0431942 (select-kit-2) to initOptions. This means that the ember router does not automatically call the function after the router is initialized.

For a long time, we have been calling the initState function in the init() function of discourse-location, which caused an imperceptible URL change to the the root domain, before switching back to the correct subfolder URL when ember called initState. This commit removes that call from the initializer, so initState is only called once (by ember).

Relevant ember code: https://github.com/emberjs/ember.js/blob/v3.12.2/packages/@ember/-internals/routing/lib/system/router.ts#L695-L699
@discoursebot
Copy link

You've signed the CLA, davidtaylorhq. Thank you! This pull request is ready for review.

@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/recent-changes-breaking-subfolder-setup/141232/15

Copy link
Contributor

@jjaffeux jjaffeux left a comment

Choose a reason for hiding this comment

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

Sorry that was a total find/replace mistake

@davidtaylorhq davidtaylorhq merged commit d7d4612 into discourse:master Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants