Skip to content

Commit e549fad

Browse files
authored
Fix toggling optional props in Connect (#15231)
When toggling an optional prop in the Connect React lib, we discard any previously configured values. This change fixed that, so if a prop is disabled after configuring it, re-enabling it again will use the previoulsy configured value.
1 parent 17e2fbe commit e549fad

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

packages/connect-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/connect-react",
3-
"version": "1.0.0-preview.17",
3+
"version": "1.0.0-preview.18",
44
"description": "Pipedream Connect library for React",
55
"files": [
66
"dist"

packages/connect-react/src/hooks/form-context.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ export const FormContextProvider = <T extends ConfigurableProps>({
343343
const idx = configurableProps.findIndex((p) => p.name === prop.name);
344344
if (!enabled) {
345345
setConfiguredProp(idx, undefined);
346+
} else if (__configuredProps?.[prop.name as keyof ConfiguredProps<T>] !== undefined) {
347+
setConfiguredProp(
348+
idx,
349+
__configuredProps[prop.name as keyof ConfiguredProps<T>],
350+
);
346351
} else if ("default" in prop && prop.default != null) {
347352
setConfiguredProp(idx, prop.default);
348353
}

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)