File tree Expand file tree Collapse file tree 5 files changed +46
-11
lines changed
Expand file tree Collapse file tree 5 files changed +46
-11
lines changed Original file line number Diff line number Diff line change 11<!-- markdownlint-disable MD024 -->
22# Changelog
33
4+ # [ 1.0.0-preview.30] - 2025-02-19
5+
6+ - SelectApp and SelectComponent Improvements
7+
48# [ 1.0.0-preview.29] - 2025-02-10
59
610- Fix enableDebugging state update bug
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/connect-react" ,
3- "version" : " 1.0.0-preview.29 " ,
3+ "version" : " 1.0.0-preview.30 " ,
44 "description" : " Pipedream Connect library for React" ,
55 "files" : [
66 " dist"
1818 },
1919 "scripts" : {
2020 "build" : " vite build" ,
21- "prepare" : " pnpm run build"
21+ "prepare" : " pnpm run build" ,
22+ "watch" : " NODE_ENV=development vite build --watch --mode development"
2223 },
2324 "publishConfig" : {
2425 "access" : " public"
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ export function SelectApp({
2525 } = useApps ( {
2626 q,
2727 } ) ;
28- const { Option } = components ;
28+ const {
29+ Option,
30+ SingleValue,
31+ } = components ;
32+ const selectedValue = apps ?. find ( ( o ) => o . name_slug === value ?. name_slug ) || null ;
2933 return (
3034 < Select
3135 instanceId = { instanceId }
@@ -52,14 +56,39 @@ export function SelectApp({
5256 </ div >
5357 </ Option >
5458 ) ,
59+ SingleValue : ( singleValueProps ) => (
60+ < SingleValue { ...singleValueProps } >
61+ < div style = { {
62+ display : "flex" ,
63+ gap : 10 ,
64+ alignItems : "center" ,
65+ } } >
66+ < img
67+ src = { `https://pipedream.com/s.v0/${ singleValueProps . data . id } /logo/48` }
68+ style = { {
69+ height : 24 ,
70+ width : 24 ,
71+ } }
72+ alt = { singleValueProps . data . name }
73+ />
74+ < span style = { {
75+ whiteSpace : "nowrap" ,
76+ } } >
77+ { singleValueProps . data . name }
78+ </ span >
79+ </ div >
80+ </ SingleValue >
81+ ) ,
5582 IndicatorSeparator : ( ) => null ,
5683 } }
5784 options = { apps || [ ] }
5885 getOptionLabel = { ( o ) => o . name || o . name_slug } // TODO fetch initial value app so we show name
5986 getOptionValue = { ( o ) => o . name_slug }
60- value = { value }
87+ value = { selectedValue }
6188 onChange = { ( o ) => onChange ?.( ( o as AppResponse ) || undefined ) }
62- onInputChange = { ( v ) => setQ ( v ) }
89+ onInputChange = { ( v ) => {
90+ if ( v ) setQ ( v )
91+ } }
6392 isLoading = { isLoading }
6493 />
6594 ) ;
Original file line number Diff line number Diff line change @@ -20,22 +20,23 @@ export function SelectComponent({
2020} : SelectComponentProps ) {
2121 const instanceId = useId ( ) ;
2222 const {
23- isLoading,
24- // TODO error
25- components,
23+ isLoading, components,
2624 } = useComponents ( {
2725 app : app ?. name_slug ,
2826 componentType,
2927 } ) ;
28+
29+ const selectedValue = components ?. find ( ( c ) => c . key === value ?. key ) || null ;
30+
3031 return (
3132 < Select
3233 instanceId = { instanceId }
3334 className = "react-select-container text-sm"
3435 classNamePrefix = "react-select"
3536 options = { components }
36- getOptionLabel = { ( o ) => o . name || o . key } // TODO fetch default component so we show name (or just prime correctly in demo)
37+ getOptionLabel = { ( o ) => o . name || o . key }
3738 getOptionValue = { ( o ) => o . key }
38- value = { value }
39+ value = { selectedValue }
3940 onChange = { ( o ) => onChange ?.( ( o as V1Component ) || undefined ) }
4041 isLoading = { isLoading }
4142 components = { {
Original file line number Diff line number Diff line change @@ -17,6 +17,6 @@ export const useApps = (input?: GetAppsOpts) => {
1717
1818 return {
1919 ...query ,
20- apps : query . data ?. data ,
20+ apps : query . data ?. data || [ ] ,
2121 } ;
2222} ;
You can’t perform that action at this time.
0 commit comments