mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
Merge branch 'main' into fix/sortable-cell-style
This commit is contained in:
commit
775e45d229
@ -25,6 +25,7 @@ import Input from 'component/common/Input/Input';
|
|||||||
import { formatUnknownError } from 'utils/formatUnknownError';
|
import { formatUnknownError } from 'utils/formatUnknownError';
|
||||||
import useUnleashContext from 'hooks/api/getters/useUnleashContext/useUnleashContext';
|
import useUnleashContext from 'hooks/api/getters/useUnleashContext/useUnleashContext';
|
||||||
import { HelpIcon } from 'component/common/HelpIcon/HelpIcon';
|
import { HelpIcon } from 'component/common/HelpIcon/HelpIcon';
|
||||||
|
import produce from 'immer';
|
||||||
|
|
||||||
const payloadOptions = [
|
const payloadOptions = [
|
||||||
{ key: 'string', label: 'string' },
|
{ key: 'string', label: 'string' },
|
||||||
@ -199,27 +200,18 @@ export const AddVariant = ({
|
|||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateOverrideType =
|
const updateOverrideType = (index: number) => (value: string) => {
|
||||||
(index: number, contextName: string) => (value: string) => {
|
setOverrides(
|
||||||
setOverrides(
|
produce(draft => {
|
||||||
overrides.map((o, i) => {
|
draft[index].contextName = value;
|
||||||
if (i === index) {
|
})
|
||||||
// @ts-expect-error
|
);
|
||||||
o[contextName] = value;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
return o;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateOverrideValues = (index: number, values: string[]) => {
|
const updateOverrideValues = (index: number, values: string[]) => {
|
||||||
setOverrides(
|
setOverrides(
|
||||||
overrides.map((o, i) => {
|
produce(draft => {
|
||||||
if (i === index) {
|
draft[index].values = values;
|
||||||
o.values = values;
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ export const OverrideConfig = ({
|
|||||||
classes={{
|
classes={{
|
||||||
root: classnames(commonStyles.fullWidth),
|
root: classnames(commonStyles.fullWidth),
|
||||||
}}
|
}}
|
||||||
onChange={updateOverrideType(i, o.contextName)}
|
onChange={updateOverrideType(i)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid md={7} sm={7} xs={6} item>
|
<Grid md={7} sm={7} xs={6} item>
|
||||||
|
Loading…
Reference in New Issue
Block a user