mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: correct type for variant stickiness dropdown
This commit is contained in:
parent
4c2ec052f6
commit
52e25bd632
@ -42,7 +42,7 @@ const FeatureOverviewVariants = () => {
|
|||||||
const { patchFeatureVariants } = useFeatureApi();
|
const { patchFeatureVariants } = useFeatureApi();
|
||||||
const [editVariant, setEditVariant] = useState({});
|
const [editVariant, setEditVariant] = useState({});
|
||||||
const [showAddVariant, setShowAddVariant] = useState(false);
|
const [showAddVariant, setShowAddVariant] = useState(false);
|
||||||
const [stickinessOptions, setStickinessOptions] = useState([]);
|
const [stickinessOptions, setStickinessOptions] = useState<string[]>([]);
|
||||||
const [delDialog, setDelDialog] = useState({ name: '', show: false });
|
const [delDialog, setDelDialog] = useState({ name: '', show: false });
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -58,7 +58,6 @@ const FeatureOverviewVariants = () => {
|
|||||||
...context.filter(c => c.stickiness).map(c => c.name),
|
...context.filter(c => c.stickiness).map(c => c.name),
|
||||||
];
|
];
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
setStickinessOptions(options);
|
setStickinessOptions(options);
|
||||||
}, [context]);
|
}, [context]);
|
||||||
|
|
||||||
@ -102,15 +101,12 @@ const FeatureOverviewVariants = () => {
|
|||||||
const options = stickinessOptions.map(c => ({ key: c, label: c }));
|
const options = stickinessOptions.map(c => ({ key: c, label: c }));
|
||||||
|
|
||||||
// guard on stickiness being disabled for context field.
|
// guard on stickiness being disabled for context field.
|
||||||
// @ts-expect-error
|
|
||||||
if (!stickinessOptions.includes(value)) {
|
if (!stickinessOptions.includes(value)) {
|
||||||
// @ts-expect-error
|
|
||||||
options.push({ key: value, label: value });
|
options.push({ key: value, label: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error
|
const onChange = (value: string) => {
|
||||||
const onChange = event => {
|
updateStickiness(value).catch(console.warn);
|
||||||
updateStickiness(event.target.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user