FIX: Subfolder sites rewriting URLs to root domain on initial load (#8932)
The `DiscourseLocation.initState` function was accidently renamed in 0431942f
(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
This commit is contained in:
parent
47f255f62c
commit
d7d4612b2d
|
@ -18,7 +18,6 @@ const DiscourseLocation = EmberObject.extend({
|
|||
this._super(...arguments);
|
||||
|
||||
this.set("location", this.location || window.location);
|
||||
this.initOptions();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -26,9 +25,9 @@ const DiscourseLocation = EmberObject.extend({
|
|||
|
||||
Used to set state on first call to setURL
|
||||
|
||||
@method initOptions
|
||||
@method initState
|
||||
*/
|
||||
initOptions() {
|
||||
initState() {
|
||||
const history = this.history || window.history;
|
||||
if (history && history.scrollRestoration) {
|
||||
history.scrollRestoration = "manual";
|
||||
|
|
Loading…
Reference in New Issue