https://github.com/opensearch-project/oui/pull/1137#discussion_r1416035533 This seems like it could be extracted into a function and use return rather than a mutable variable.