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 select on history change #3592

Open
wants to merge 1 commit into
base: master-mysterious-egg
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventBus, onMounted, useRef, useSubEnv } from "@odoo/owl";
import { Component, EventBus, useRef, useSubEnv } from "@odoo/owl";
import { Dropdown } from "@web/core/dropdown/dropdown";
import { basicContainerWeWidgetProps, useWeComponent } from "../builder_helpers";
import { useDropdownState } from "@web/core/dropdown/dropdown_hooks";
Expand All @@ -17,10 +17,6 @@ export class WeSelect extends Component {
const button = useRef("button");
useWeComponent();
this.dropdown = useDropdownState();
this.firstRender = true;
onMounted(() => {
this.firstRender = false;
});
useSubEnv({
weSelectBus: new EventBus(),
weSetSelectLabel: (labelHtml) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<t t-name="html_builder.WeSelect">
<!-- Render the SelectItem(s) into an invisible node to ensure the label of the
button is being set. -->
<div t-if="firstRender" class="d-none"><t t-slot="default" /></div>
<div class="d-none"><t t-slot="default" /></div>
<Dropdown state="this.dropdown">
<button class="btn btn-primary mx-1" t-ref="button" />
<t t-set-slot="content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, onMounted, useRef } from "@odoo/owl";
import { clickableWeWidgetProps, useClickableWeWidget } from "../builder_helpers";
import { useBus } from "@web/core/utils/hooks";

export class WeSelectItem extends Component {
static template = "html_builder.WeSelectItem";
Expand All @@ -17,6 +18,7 @@ export class WeSelectItem extends Component {
this.env.weSetSelectLabel?.(item.el.innerHTML);
}
};
useBus(this.env.editorBus, "STEP_ADDED", setSelectLabel);
onMounted(setSelectLabel);

this.state = state;
Expand Down