Skip to content

Commit b22164a

Browse files
committed
some changes
1 parent 611a1cc commit b22164a

File tree

8 files changed

+18
-4155
lines changed

8 files changed

+18
-4155
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default [
3737
"**/*.lock",
3838
"**/*.py",
3939
"**/*.png",
40+
"**/.next",
4041
],
4142
},
4243
...compat.extends(

packages/connect-react/.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type ComponentFormProps<T extends ConfigurableProps = any> = {
1414
configuredProps?: ConfiguredProps<T>; // XXX value?
1515
disableQueryDisabling?: boolean;
1616
propNames?: string[]; // TODO PropNames<T>
17-
onSubmit?: (ctx: FormContext) => void | Promise<void>; // if passed, we include button
17+
onSubmit?: (ctx: FormContext<T>) => void | Promise<void>; // if passed, we include button
1818
onUpdateConfiguredProps?: (v: ConfiguredProps<T>) => void; // XXX onChange?
1919
hideOptionalProps?: boolean;
2020
};

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@ import {
44
import isEqual from "lodash.isequal";
55
import { useQuery } from "@tanstack/react-query";
66
import type {
7-
ComponentReloadPropsOpts, ConfigurableProp, V1Component,
7+
ComponentReloadPropsOpts, ConfigurableProp, ConfigurableProps, ConfiguredProps, V1Component,
88
} from "@pipedream/sdk";
99
import { useFrontendClient } from "./frontend-client-context";
1010
import type { ComponentFormProps } from "../components/ComponentForm";
1111

12-
export type DynamicProps = { id: string; configurable_props: any; }; // TODO
12+
export type DynamicProps<T extends ConfigurableProps> = { id: string; configurable_props: T; }; // TODO
1313

14-
export type FormContext = {
15-
component: V1Component; // XXX <T>
16-
configurableProps: any[]; // dynamicProps.configurable_props || props.component.configurable_props
17-
configuredProps: Record<string, any>; // TODO
18-
dynamicProps?: DynamicProps; // lots of calls require dynamicProps?.id, so need to expose
14+
export type FormContext<T extends ConfigurableProps> = {
15+
component: V1Component<T>;
16+
configurableProps: T; // dynamicProps.configurable_props || props.component.configurable_props
17+
configuredProps: ConfiguredProps<T>;
18+
dynamicProps?: DynamicProps<T>; // lots of calls require dynamicProps?.id, so need to expose
1919
dynamicPropsQueryIsFetching?: boolean;
2020
id: string;
2121
isValid: boolean;
2222
optionalPropIsEnabled: (prop: ConfigurableProp) => boolean;
2323
optionalPropSetEnabled: (prop: ConfigurableProp, enabled: boolean) => void;
2424
props: ComponentFormProps;
2525
queryDisabledIdx?: number;
26-
setConfiguredProp: (idx: number, value: any) => void; // XXX would be nice to have type safety here
26+
setConfiguredProp: (idx: number, value: unknown) => void; // XXX type safety for value (T will rarely be static right?)
2727
setSubmitting: (submitting: boolean) => void;
2828
submitting: boolean;
2929
userId: string;
3030
};
3131

32-
export const FormContext = createContext<FormContext | undefined>(undefined);
32+
export const FormContext = createContext<FormContext<any /* XXX fix */> | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any
3333

3434
export const useFormContext = () => {
3535
const context = useContext(FormContext);
@@ -50,7 +50,7 @@ type FormContextProviderProps = {
5050

5151
export const FormContextProvider: React.FC<FormContextProviderProps> = ({
5252
children, props,
53-
}) => {
53+
}: FormContextProviderProps) => {
5454
const client = useFrontendClient();
5555

5656
const id = useId();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77

88
export type FormFieldContextExtra<T extends ConfigurableProp> = T extends ConfigurablePropApp ? {
99
app?: AppInfo;
10-
} : {};
10+
} : Record<string, never>;
1111

1212
export type FormFieldContext<T extends ConfigurableProp> = {
1313
id: string;
@@ -18,7 +18,7 @@ export type FormFieldContext<T extends ConfigurableProp> = {
1818
extra: FormFieldContextExtra<T>;
1919
};
2020

21-
export const FormFieldContext = createContext<FormFieldContext<any> | undefined>(undefined);
21+
export const FormFieldContext = createContext<FormFieldContext<any /* XXX fix */> | undefined>(undefined); // eslint-disable-line @typescript-eslint/no-explicit-any
2222

2323
export const useFormFieldContext = <T extends ConfigurableProp>() => {
2424
const context = useContext(FormFieldContext);

packages/connect-react/src/hooks/frontend-client-context.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type FrontendClientProviderProps = { children: React.ReactNode; client: BrowserC
2525
export const FrontendClientProvider: React.FC<FrontendClientProviderProps> = ({
2626
children,
2727
client,
28-
}) => {
28+
}: FrontendClientProviderProps) => {
2929
const queryClient = new QueryClient({
3030
defaultOptions: {
3131
queries: {

0 commit comments

Comments
 (0)