From 24249cfdab72e0db0f00f700fcaa03cdcb1a0b1a Mon Sep 17 00:00:00 2001
From: Pierre Michel <pmiche04@gmail.com>
Date: Tue, 18 Jul 2023 06:53:36 -0600
Subject: [PATCH 1/4] Fix: When the language changes, we should not change the
 focused index in a list

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
---
 src/components/OptionsSelector/BaseOptionsSelector.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js
index 017359b34173..46a2a193f668 100755
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -130,7 +130,15 @@ class BaseOptionsSelector extends Component {
         }
 
         const newOptions = this.flattenSections();
+        //If only the preferredLocale has changed we don't update the focused index
+        if(prevProps.preferredLocale != this.props.preferredLocale){
+            this.setState({
+                allOptions: newOptions,
+            });
+            return;
+        }
         const newFocusedIndex = this.props.selectedOptions.length;
+
         // eslint-disable-next-line react/no-did-update-set-state
         this.setState(
             {

From a5b9060988a6d2f667dde8de47d03cca075271a9 Mon Sep 17 00:00:00 2001
From: Pierre Michel <pmiche04@gmail.com>
Date: Tue, 18 Jul 2023 12:20:12 -0600
Subject: [PATCH 2/4] Fix lint errors

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
---
 src/components/OptionsSelector/BaseOptionsSelector.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js
index 46a2a193f668..4aff7adb8f31 100755
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -130,8 +130,8 @@ class BaseOptionsSelector extends Component {
         }
 
         const newOptions = this.flattenSections();
-        //If only the preferredLocale has changed we don't update the focused index
-        if(prevProps.preferredLocale != this.props.preferredLocale){
+        // If only the preferredLocale has changed we don't update the focused index
+        if (prevProps.preferredLocale !== this.props.preferredLocale){
             this.setState({
                 allOptions: newOptions,
             });

From 22ae3abb868539d9fb2f367a8111e5e10748f438 Mon Sep 17 00:00:00 2001
From: Pierre Michel <pmiche04@gmail.com>
Date: Tue, 18 Jul 2023 12:27:54 -0600
Subject: [PATCH 3/4] After npm run prettier

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
---
 src/components/OptionsSelector/BaseOptionsSelector.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js
index 4aff7adb8f31..b77c481adbec 100755
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -131,7 +131,7 @@ class BaseOptionsSelector extends Component {
 
         const newOptions = this.flattenSections();
         // If only the preferredLocale has changed we don't update the focused index
-        if (prevProps.preferredLocale !== this.props.preferredLocale){
+        if (prevProps.preferredLocale !== this.props.preferredLocale) {
             this.setState({
                 allOptions: newOptions,
             });

From f56b122daded557955ecae382d0bc53fb3a6e069 Mon Sep 17 00:00:00 2001
From: Pierre Michel <pmiche04@gmail.com>
Date: Wed, 19 Jul 2023 08:51:12 -0600
Subject: [PATCH 4/4] Remove unnecessary comment

Signed-off-by: Pierre Michel <pmiche04@gmail.com>
---
 src/components/OptionsSelector/BaseOptionsSelector.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/OptionsSelector/BaseOptionsSelector.js b/src/components/OptionsSelector/BaseOptionsSelector.js
index b77c481adbec..5941f6d17ac0 100755
--- a/src/components/OptionsSelector/BaseOptionsSelector.js
+++ b/src/components/OptionsSelector/BaseOptionsSelector.js
@@ -130,7 +130,7 @@ class BaseOptionsSelector extends Component {
         }
 
         const newOptions = this.flattenSections();
-        // If only the preferredLocale has changed we don't update the focused index
+
         if (prevProps.preferredLocale !== this.props.preferredLocale) {
             this.setState({
                 allOptions: newOptions,
