From aedb6a52d53d714da1563253d32cc955b47f5e93 Mon Sep 17 00:00:00 2001 From: Yulia Shanyrova Date: Tue, 11 Oct 2022 16:08:43 +0200 Subject: [PATCH] Changed the order of concating values --- grafana-plugin/src/containers/RemoteSelect/RemoteSelect.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grafana-plugin/src/containers/RemoteSelect/RemoteSelect.tsx b/grafana-plugin/src/containers/RemoteSelect/RemoteSelect.tsx index 675357e9..4f281542 100644 --- a/grafana-plugin/src/containers/RemoteSelect/RemoteSelect.tsx +++ b/grafana-plugin/src/containers/RemoteSelect/RemoteSelect.tsx @@ -61,8 +61,8 @@ const RemoteSelect = inject('store')( }; function mergeOptions(oldOptions: SelectableValue[], newOptions: SelectableValue[]) { - const existedValues = oldOptions.map((o) => o.value); - return newOptions.filter(({ value }) => !existedValues.includes(value)).concat(oldOptions); + const existingValues = oldOptions.map((o) => o.value); + return oldOptions.concat(newOptions.filter(({ value }) => !existingValues.includes(value))); } const [options, setOptions] = useReducer(mergeOptions, []);