Revert "DEV: Defer button actions with layout change to the next frame paint (#27967)" (#28020)

This is causing issues with some buttons on iOS. Reverting while we investigate.

This reverts commit 352d6f9dfb.
This commit is contained in:
David Taylor 2024-07-22 17:35:23 +01:00 committed by GitHub
parent 747fe63db3
commit a267c0727d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 31 deletions

View File

@ -6,7 +6,6 @@ import { htmlSafe } from "@ember/template";
import { or } from "truth-helpers";
import GlimmerComponentWithDeprecatedParentView from "discourse/components/glimmer-component-with-deprecated-parent-view";
import concatClass from "discourse/helpers/concat-class";
import runAfterFramePaint from "discourse/lib/after-frame-paint";
import icon from "discourse-common/helpers/d-icon";
import deprecated from "discourse-common/lib/deprecated";
import I18n from "discourse-i18n";
@ -119,17 +118,17 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
);
}
} else if (typeof actionVal === "object" && actionVal.value) {
runAfterFramePaint(() =>
forwardEvent
? actionVal.value(actionParam, event)
: actionVal.value(actionParam)
);
if (forwardEvent) {
actionVal.value(actionParam, event);
} else {
actionVal.value(actionParam);
}
} else if (typeof actionVal === "function") {
runAfterFramePaint(() =>
forwardEvent
? actionVal(actionParam, event)
: actionVal(actionParam)
);
if (forwardEvent) {
actionVal(actionParam, event);
} else {
actionVal(actionParam);
}
}
} else if (route) {
this.router.transitionTo(route);

View File

@ -1,4 +1,4 @@
import { DEBUG } from "@glimmer/env";
import DEBUG from "@glimmer/env";
import { registerWaiter } from "@ember/test";
import { isTesting } from "discourse-common/config/environment";

View File

@ -2,7 +2,6 @@ import { alias, match } from "@ember/object/computed";
import Mixin from "@ember/object/mixin";
import { schedule, throttle } from "@ember/runloop";
import { service } from "@ember/service";
import runAfterFramePaint from "discourse/lib/after-frame-paint";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import { headerOffset } from "discourse/lib/offset-calculator";
import DiscourseURL from "discourse/lib/url";
@ -87,11 +86,9 @@ export default Mixin.create({
document.querySelector(".card-cloak")?.classList.remove("hidden");
this.appEvents.trigger("user-card:show", { username });
runAfterFramePaint(() => {
this._positionCard(target, event);
this._showCallback(username).then((user) => {
this.appEvents.trigger("user-card:after-show", { user });
});
this._positionCard(target, event);
this._showCallback(username).then((user) => {
this.appEvents.trigger("user-card:after-show", { user });
});
// We bind scrolling on mobile after cards are shown to hide them if user scrolls

View File

@ -34,10 +34,6 @@ describe "Homepage", type: :system do
# Wait for the save to complete
find(".btn-primary.save-changes:not([disabled])", wait: 5)
try_until_success do
visit "/u/#{user.username}/preferences/interface"
homepage_picker.has_selected_name?("Top")
end
visit "/"
@ -93,12 +89,9 @@ describe "Homepage", type: :system do
homepage_picker.select_row_by_name("Top")
page.find(".btn-primary.save-changes").click
# Make sure save is complete
# Wait for the save to complete
find(".btn-primary.save-changes:not([disabled])", wait: 5)
try_until_success do
visit "/u/#{user.username}/preferences/interface"
homepage_picker.has_selected_name?("Top")
end
expect(user.user_option.homepage_id).to eq(UserOption::HOMEPAGES.key("top"))
find("#site-logo").click
expect(page).to have_css(".navigation-container .top.active", text: "Top")
@ -114,10 +107,7 @@ describe "Homepage", type: :system do
# Wait for the save to complete
find(".btn-primary.save-changes:not([disabled])", wait: 5)
try_until_success do
visit "/u/#{user.username}/preferences/interface"
homepage_picker.has_selected_name?("(default)")
end
expect(user.reload.user_option.homepage_id).to_not eq(UserOption::HOMEPAGES.key("top"))
find("#site-logo").click