From 1289ca91037123716de12d18d622fc360f1cc3ae Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Mon, 13 Jan 2020 10:26:48 -0800 Subject: [PATCH] update TagMultiSelect to use PF ); - // - // return ( - // { - // onChange(arrayToString(val)); - // }} - // onAddNewItem={newItem => { - // if (!options.find(o => o.name === newItem.name)) { - // setOptions(options.concat(newItem)); - // } - // }} - // value={stringToArray(value)} - // options={options} - // createNewItem={name => ({ id: name, name })} - // /> - // ); } TagMultiSelect.propTypes = { diff --git a/awx/ui_next/src/components/MultiSelect/index.js b/awx/ui_next/src/components/MultiSelect/index.js index 145029344a..fc192d36cf 100644 --- a/awx/ui_next/src/components/MultiSelect/index.js +++ b/awx/ui_next/src/components/MultiSelect/index.js @@ -1,3 +1,2 @@ -export { default } from './MultiSelect'; export { default as TagMultiSelect } from './TagMultiSelect'; export { default as usePFSelect } from './usePFSelect'; diff --git a/awx/ui_next/src/components/MultiSelect/usePFSelect.js b/awx/ui_next/src/components/MultiSelect/usePFSelect.js index 74d4e89a1b..b347b7a919 100644 --- a/awx/ui_next/src/components/MultiSelect/usePFSelect.js +++ b/awx/ui_next/src/components/MultiSelect/usePFSelect.js @@ -1,7 +1,8 @@ import { useState, useEffect } from 'react'; /* - Hook for using PatternFly's component when a pre-existing value + is loaded from somewhere other than the options. Guarantees object equality between objects in `value` and the corresponding objects loaded as `options` (based on matched id value). */ @@ -11,7 +12,6 @@ export default function usePFSelect(value, onChange) { useEffect(() => { if (value !== selections && options.length) { - console.log(value, typeof value); const syncedValue = value.map(item => options.find(i => i.id === item.id) ); @@ -48,5 +48,5 @@ function addToStringToObjects(items = []) { } function toString() { - return this.id; + return String(this.id); }