Skip to content

Commit a5272e6

Browse files
committed
refactor: change to useSetup
1 parent 60ee798 commit a5272e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/shared/widget-plugin-dropdown-filter/src/containers/StaticFilterContainer.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { usePickerJSActions } from "../helpers/usePickerJSActions";
1515
import { withCustomOptionsGuard } from "../hocs/withCustomOptionsGuard";
1616
import { StaticSelectFilterStore } from "../stores/StaticSelectFilterStore";
1717
import { FilterOptionsType, SelectedItemsStyleEnum, SelectionMethodEnum } from "../typings/widget";
18+
import { useSetup } from "@mendix/widget-plugin-mobx-kit/react/useSetup";
1819

1920
export interface StaticFilterContainerProps {
2021
ariaLabel?: string;
@@ -52,7 +53,7 @@ function Container(props: StaticFilterContainerProps): React.ReactElement {
5253

5354
const SelectWidget = observer(function SelectWidget(props: StaticFilterContainerProps): React.ReactElement {
5455
const gate = useGate(props);
55-
const ctrl1 = useConst(() => new StaticSelectController({ gate }));
56+
const ctrl1 = useSetup(() => new StaticSelectController({ gate }));
5657

5758
usePickerJSActions(ctrl1, props);
5859

@@ -73,7 +74,7 @@ const SelectWidget = observer(function SelectWidget(props: StaticFilterContainer
7374

7475
const ComboboxWidget = observer(function ComboboxWidget(props: StaticFilterContainerProps): React.ReactElement {
7576
const gate = useGate(props);
76-
const ctrl2 = useConst(() => new StaticComboboxController({ gate }));
77+
const ctrl2 = useSetup(() => new StaticComboboxController({ gate }));
7778

7879
usePickerJSActions(ctrl2, props);
7980

@@ -94,7 +95,7 @@ const ComboboxWidget = observer(function ComboboxWidget(props: StaticFilterConta
9495

9596
const TagPickerWidget = observer(function TagPickerWidget(props: StaticFilterContainerProps): React.ReactElement {
9697
const gate = useGate(props);
97-
const ctrl3 = useConst(() => new StaticTagPickerController({ gate }));
98+
const ctrl3 = useSetup(() => new StaticTagPickerController({ gate }));
9899

99100
usePickerJSActions(ctrl3, props);
100101

0 commit comments

Comments
 (0)