Skip to content

Commit 95b8792

Browse files
committed
feat(connect-react): onUpdateDynamicProps (1.0.0-preview.15)
1 parent 5dca035 commit 95b8792

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

packages/connect-react/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<!-- markdownlint-disable MD024 -->
22
# Changelog
33

4+
# [1.0.0-preview.15] - 2024-12-18
5+
6+
- Emit dynamic props via `onUpdateDynamicProps`
7+
48
# [1.0.0-preview.14] - 2024-12-17
59

610
- Fixed one case of "maximum update depth exceeded" (useEffect component dependency)

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.14",
3+
"version": "1.0.0-preview.15",
44
"description": "Pipedream Connect library for React",
55
"files": [
66
"dist"

packages/connect-react/src/components/ComponentForm.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
DynamicProps,
23
FormContextProvider, type FormContext,
34
} from "../hooks/form-context";
45
import type {
@@ -13,9 +14,11 @@ export type ComponentFormProps<T extends ConfigurableProps, U = ConfiguredProps<
1314
component: V1Component<T>;
1415
configuredProps?: U; // XXX value?
1516
disableQueryDisabling?: boolean;
17+
// dynamicPropsId?: string // XXX need to load this initially when passed
1618
propNames?: string[]; // TODO PropNames<T>
1719
onSubmit?: (ctx: FormContext<T>) => void | Promise<void>; // if passed, we include button
1820
onUpdateConfiguredProps?: (v: U) => void; // XXX onChange?
21+
onUpdateDynamicProps?: (dp: DynamicProps<T>) => void;
1922
hideOptionalProps?: boolean;
2023
};
2124

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
141141
// XXX what about if null?
142142
// TODO observation errors, etc.
143143
if (dynamicProps) {
144+
formProps.onUpdateDynamicProps?.(dynamicProps);
144145
setDynamicProps(dynamicProps);
145146
}
146147
setReloadPropIdx(undefined);

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)