From ec9dfa1cdb108245042b370a3da363d4d237d402 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Fri, 6 Dec 2024 17:33:23 -0800 Subject: [PATCH 1/6] Fix dynamic props in the Connect demo app * Switch from snake to camel case to match API response * Upgrade SDK --- .../connect-react/src/hooks/form-context.tsx | 16 ++++++++-------- pnpm-lock.yaml | 10 ++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index b853561bd66c4..79af4375b8ce5 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -9,11 +9,11 @@ import type { import { useFrontendClient } from "./frontend-client-context"; import type { ComponentFormProps } from "../components/ComponentForm"; -export type DynamicProps = { id: string; configurable_props: T; }; // TODO +export type DynamicProps = { id: string; configurableProps: T; }; // TODO export type FormContext = { component: V1Component; - configurableProps: T; // dynamicProps.configurable_props || props.component.configurable_props + configurableProps: T; // dynamicProps.configurableProps || props.component.configurableProps configuredProps: ConfiguredProps; dynamicProps?: DynamicProps; // lots of calls require dynamicProps?.id, so need to expose dynamicPropsQueryIsFetching?: boolean; @@ -117,11 +117,11 @@ export const FormContextProvider = ({ "dynamicProps", ], queryFn: async () => { - const { dynamic_props } = await client.componentReloadProps(componentReloadPropsInput); + const { dynamicProps } = await client.componentReloadProps(componentReloadPropsInput); // XXX what about if null? // TODO observation errors, etc. - if (dynamic_props) { - setDynamicProps(dynamic_props); + if (dynamicProps) { + setDynamicProps(dynamicProps); } setReloadPropIdx(undefined); return []; // XXX ok to mutate above and not look at data? @@ -130,7 +130,7 @@ export const FormContextProvider = ({ }); // XXX fix types of dynamicProps, props.component so this type decl not needed - let configurableProps: T = dynamicProps?.configurable_props || formProps.component.configurable_props || []; + let configurableProps: T = dynamicProps?.configurableProps || formProps.component.configurable_props || []; if (propNames?.length) { const _configurableProps = []; for (const prop of configurableProps) { @@ -169,7 +169,7 @@ export const FormContextProvider = ({ errs.push("not a boolean"); } } else if (prop.type === "string") { - if (typeof value !== "string" ) { + if (typeof value !== "string") { errs.push("not a string"); } } else if (prop.type === "app") { @@ -179,7 +179,7 @@ export const FormContextProvider = ({ }; const updateConfiguredPropsQueryDisabledIdx = (configuredProps: ConfiguredProps) => { - let _queryDisabledIdx = undefined; + let _queryDisabledIdx = undefined; for (let idx = 0; idx < configurableProps.length; idx++) { const prop = configurableProps[idx]; if (prop.hidden || (prop.optional && !optionalPropIsEnabled(prop))) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 647509ff7ce6a..fca0576bc0dfc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24472,22 +24472,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} @@ -30645,6 +30645,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: From 48c0f5b27934d3e1794658f9b67aef828d91d3a7 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 9 Dec 2024 10:09:11 -0800 Subject: [PATCH 2/6] Fix linter issues --- packages/connect-react/src/hooks/form-context.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index 79af4375b8ce5..f6d37ecb66dcf 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -241,7 +241,10 @@ export const FormContextProvider = ({ ]); // clear all props on user change - const [prevUserId, setPrevUserId] = useState(userId) + const [ + prevUserId, + setPrevUserId, + ] = useState(userId) useEffect(() => { if (prevUserId !== userId) { updateConfiguredProps({}); From ef1cd336b39429e1df8b9efd9f18c95a81bd53e0 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 9 Dec 2024 10:09:26 -0800 Subject: [PATCH 3/6] Bump preview version --- packages/connect-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-react/package.json b/packages/connect-react/package.json index 4bc3e64c7a4ac..f4243285895fb 100644 --- a/packages/connect-react/package.json +++ b/packages/connect-react/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/connect-react", - "version": "1.0.0-preview.7", + "version": "1.0.0-preview.8", "description": "Pipedream Connect library for React", "files": [ "dist" From df45457229b90443f9446fc5e630f90c48fc8a40 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 9 Dec 2024 10:10:00 -0800 Subject: [PATCH 4/6] Update PNPM lock file --- pnpm-lock.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fca0576bc0dfc..5ba25942aed8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12129,10 +12129,10 @@ importers: version: 14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) nextra: specifier: latest - version: 3.2.4(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + version: 3.2.5(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) nextra-theme-docs: specifier: latest - version: 3.2.4(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.4(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 3.2.5(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.5(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: specifier: ^18.3.1 version: 18.3.1 @@ -22324,16 +22324,16 @@ packages: sass: optional: true - nextra-theme-docs@3.2.4: - resolution: {integrity: sha512-3fg7zMHInuvSDURRJjh6UrbdqkK8uLs8RNriY38kVukWLvaVP2f6mmVJKIYqxVv6qAKWEzDLTr4dlJCY81eXuQ==} + nextra-theme-docs@3.2.5: + resolution: {integrity: sha512-eF0j1VNNS1rFjZOfYqlrXISaCU3+MhZ9hhXY+TUydRlfELrFWpGzrpW6MiL7hq4JvUR7OBtHHs8+A+8AYcETBQ==} peerDependencies: next: '>=13' - nextra: 3.2.4 + nextra: 3.2.5 react: '>=18' react-dom: '>=18' - nextra@3.2.4: - resolution: {integrity: sha512-xvQuPVtRoJTz4ynIbEkxYkEtviIX699lt4coij2IMmafYrBNaD0Ofj93jIz7VngYxyT9f4gWSiwqNgoIlnbsjQ==} + nextra@3.2.5: + resolution: {integrity: sha512-n665DRpI/brjHXM83G5LdlbYA2nOtjaLcWJs7mZS3gkuRDmEXpJj4XJ860xrhkYZW2iYoUMu32zzhPuFByU7VA==} engines: {node: '>=18'} peerDependencies: next: '>=13' @@ -39662,7 +39662,7 @@ snapshots: - '@babel/core' - babel-plugin-macros - nextra-theme-docs@3.2.4(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.4(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + nextra-theme-docs@3.2.5(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(nextra@3.2.5(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@headlessui/react': 2.2.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) clsx: 2.1.1 @@ -39670,13 +39670,13 @@ snapshots: flexsearch: 0.7.43 next: 14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) next-themes: 0.4.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - nextra: 3.2.4(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + nextra: 3.2.5(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) react: 18.3.1 react-dom: 18.3.1(react@18.3.1) scroll-into-view-if-needed: 3.1.0 zod: 3.23.8 - nextra@3.2.4(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3): + nextra@3.2.5(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3): dependencies: '@formatjs/intl-localematcher': 0.5.8 '@headlessui/react': 2.2.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) From e8f9720f7bf6df62bf7f472f7c2437eb105d1fa3 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 9 Dec 2024 13:04:59 -0800 Subject: [PATCH 5/6] Amend comment --- packages/connect-react/src/hooks/form-context.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/connect-react/src/hooks/form-context.tsx b/packages/connect-react/src/hooks/form-context.tsx index f6d37ecb66dcf..19cfde742b473 100644 --- a/packages/connect-react/src/hooks/form-context.tsx +++ b/packages/connect-react/src/hooks/form-context.tsx @@ -13,7 +13,7 @@ export type DynamicProps = { id: string; configurab export type FormContext = { component: V1Component; - configurableProps: T; // dynamicProps.configurableProps || props.component.configurableProps + configurableProps: T; // dynamicProps.configurableProps || props.component.configurable_props configuredProps: ConfiguredProps; dynamicProps?: DynamicProps; // lots of calls require dynamicProps?.id, so need to expose dynamicPropsQueryIsFetching?: boolean; From 7949c2f4bbab4589ee0205e17e2df194948cf9ed Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 9 Dec 2024 13:05:36 -0800 Subject: [PATCH 6/6] Update PNPM lock file --- pnpm-lock.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0aa788dd6d81..62738145368dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8402,8 +8402,7 @@ importers: specifier: ^1.6.2 version: 1.6.6 - components/rejoiner: - specifiers: {} + components/rejoiner: {} components/relavate: dependencies: