From 1e558af3b658a2d38bdfb0b0d0a193943918cb17 Mon Sep 17 00:00:00 2001 From: Brian Bergeron Date: Thu, 31 Aug 2023 09:29:29 -0500 Subject: [PATCH] Fix: UnitInput too narrow for small and trailing zeroed numbers (#20666) * fix: UnitInput too narrow for small and trailing zeroed numbers * lint --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- ui/components/ui/unit-input/unit-input.component.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/components/ui/unit-input/unit-input.component.js b/ui/components/ui/unit-input/unit-input.component.js index 1a186e012..96537f4c4 100644 --- a/ui/components/ui/unit-input/unit-input.component.js +++ b/ui/components/ui/unit-input/unit-input.component.js @@ -38,7 +38,10 @@ export default class UnitInput extends PureComponent { const { value: propsValue } = this.props; const { value: stateValue } = this.state; - if (prevPropsValue !== propsValue && propsValue !== stateValue) { + if ( + prevPropsValue !== propsValue && + Number(propsValue) !== Number(stateValue) + ) { this.setState({ value: propsValue }); } }