mirror of https://github.com/portainer/portainer
fix(r2a): fix layout shifting from errors showing as undefined [EE-6570] (#11000)
parent
f7840e0407
commit
d5080b6884
|
@ -38,7 +38,16 @@ export function react2angular<T, U extends PropNames<T>[]>(
|
||||||
Component: React.ComponentType<T & JSX.IntrinsicAttributes>,
|
Component: React.ComponentType<T & JSX.IntrinsicAttributes>,
|
||||||
propNames: U & ([PropNames<T>] extends [U[number]] ? unknown : PropNames<T>)
|
propNames: U & ([PropNames<T>] extends [U[number]] ? unknown : PropNames<T>)
|
||||||
): IComponentOptions & { name: string } {
|
): IComponentOptions & { name: string } {
|
||||||
const bindings = Object.fromEntries(propNames.map((key) => [key, '<']));
|
const bindings = Object.fromEntries(
|
||||||
|
propNames.map((key) => {
|
||||||
|
// use two way binding for errors, to avoid shifting the layout from errors going between undefined <-> some value when using inputs.
|
||||||
|
// See https://portainer.atlassian.net/browse/EE-6570 for more context
|
||||||
|
if (key === 'errors') {
|
||||||
|
return [key, '='];
|
||||||
|
}
|
||||||
|
return [key, '<'];
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bindings,
|
bindings,
|
||||||
|
|
Loading…
Reference in New Issue