Skip to content

Commit e2a5d98

Browse files
Linting fixes
1 parent 522f33b commit e2a5d98

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

packages/connect-react/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# [1.2.1] - 2025-06-07
66

7-
- Fix SelectApp component to properly handle controlled values when not found in search results
8-
- Fix infinite re-render issue in ComponentFormContainer by memoizing configurableProps
7+
- Fixing the SelectApp component to properly handle controlled values when not found in search results
8+
- Fixing infinite re-render issue in ComponentFormContainer by memoizing configurableProps
99

1010
# [1.2.0] - 2025-06-05
1111

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ export function SelectApp({
2121
q,
2222
setQ,
2323
] = useState(""); // Debounced query value
24-
24+
2525
const instanceId = useId();
26-
26+
2727
// Debounce the search query
2828
useEffect(() => {
2929
const timer = setTimeout(() => {
3030
setQ(inputValue);
3131
}, 300); // 300ms delay
32-
32+
3333
return () => clearTimeout(timer);
34-
}, [inputValue]);
35-
34+
}, [
35+
inputValue,
36+
]);
37+
3638
const {
3739
isLoading,
3840
// TODO error
@@ -45,8 +47,10 @@ export function SelectApp({
4547
SingleValue,
4648
} = components;
4749
// If we have a value prop but it's not in the search results, use the value prop directly
48-
const selectedValue = apps?.find((o) => o.name_slug === value?.name_slug) ||
49-
(value?.name_slug ? value as AppResponse : null);
50+
const selectedValue = apps?.find((o) => o.name_slug === value?.name_slug)
51+
|| (value?.name_slug
52+
? value as AppResponse
53+
: null);
5054
return (
5155
<Select
5256
instanceId={instanceId}

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const FormContextProvider = <T extends ConfigurableProps>({
101101
const [
102102
sdkErrors,
103103
setSdkErrors,
104-
] = useState<SdkError[]>([])
104+
] = useState<SdkError[]>([]);
105105

106106
const [
107107
enabledOptionalProps,
@@ -200,10 +200,17 @@ export const FormContextProvider = <T extends ConfigurableProps>({
200200
props = _configurableProps as unknown as T; // XXX
201201
}
202202
if (reloadPropIdx != null) {
203-
props = props.slice(0, reloadPropIdx + 1) as unknown as T; // XXX
203+
props = Array.isArray(props)
204+
? props.slice(0, reloadPropIdx + 1) as unknown as T // eslint-disable-line react/prop-types
205+
: props; // XXX
204206
}
205207
return props;
206-
}, [dynamicProps?.configurableProps, formProps.component.configurable_props, propNames, reloadPropIdx]);
208+
}, [
209+
dynamicProps?.configurableProps,
210+
formProps.component.configurable_props,
211+
propNames,
212+
reloadPropIdx,
213+
]);
207214

208215
// these validations are necessary because they might override PropInput for number case for instance
209216
// so can't rely on that base control form validation

0 commit comments

Comments
 (0)