DEV: fix flakeyness with drawer specs (#22476)
Chat drawer was using the `DiscourseURL` hook `afterRouteComplete`. This hook suffer from a very poor implementation which makes it very unreliable: ```javascript if (typeof opts.afterRouteComplete === "function") { schedule("afterRender", opts.afterRouteComplete); } ``` This commit attempts to return the promise from `handleURL` to directly use it and have a very reliable after transition hook.
This commit is contained in:
parent
a032a675c4
commit
f0d82de5d9
|
@ -464,7 +464,7 @@ const DiscourseURL = EmberObject.extend({
|
|||
transition._discourse_original_url = path;
|
||||
|
||||
const promise = transition.promise || transition;
|
||||
promise.then(() => this.jumpToElement(elementId));
|
||||
return promise.then(() => this.jumpToElement(elementId));
|
||||
},
|
||||
|
||||
jumpToElement(elementId) {
|
||||
|
|
|
@ -825,13 +825,8 @@ export default class ChatLivePane extends Component {
|
|||
onCloseFullScreen() {
|
||||
this.chatStateManager.prefersDrawer();
|
||||
|
||||
DiscourseURL.routeTo(this.chatStateManager.lastKnownAppURL, {
|
||||
afterRouteComplete: () => {
|
||||
this.appEvents.trigger(
|
||||
"chat:open-url",
|
||||
this.chatStateManager.lastKnownChatURL
|
||||
);
|
||||
},
|
||||
DiscourseURL.routeTo(this.chatStateManager.lastKnownAppURL).then(() => {
|
||||
DiscourseURL.routeTo(this.chatStateManager.lastKnownChatURL);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ RSpec.describe "Navigation", type: :system do
|
|||
end
|
||||
|
||||
context "when collapsing full page with previous state" do
|
||||
xit "redirects to previous state" do
|
||||
it "redirects to previous state" do
|
||||
visit("/t/-/#{topic.id}")
|
||||
chat_page.open_from_header
|
||||
chat_drawer_page.maximize
|
||||
|
|
Loading…
Reference in New Issue