Skip to content

Commit edf01ea

Browse files
authored
Treat empty string prop value as a valid input (#15325)
* Treat empty string prop value as a valid input * Check if a string prop is set instead of inspecting the contents of the string
1 parent 2d7cc4f commit edf01ea

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
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.20] - 2025-01-16
5+
6+
- Check if a string prop is set instead of inspecting the contents of the string
7+
48
# [1.0.0-preview.15] - 2024-12-18
59

610
- Emit dynamic props via `onUpdateDynamicProps`

packages/connect-react/examples/nextjs/package-lock.json

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

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

packages/connect-react/src/utils/component.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,13 @@ export function integerPropErrors(opts: ValidationOpts<ConfigurablePropInteger>)
9494
}
9595

9696
export function stringPropErrors(opts: ValidationOpts<ConfigurablePropString>): string[] | undefined {
97-
const _value = valueFromOption(opts.value)
97+
const {
98+
prop, value: valueOpt,
99+
} = opts
98100

99-
if (!opts.prop.default) {
100-
if (typeof _value === "undefined" || _value == null) return [
101-
"required",
102-
]
103-
if (!String(_value).length) return [
104-
"string must not be empty",
105-
]
106-
}
101+
if (!prop.default && (valueOpt == null || typeof value === "undefined")) return [
102+
"required",
103+
]
107104
}
108105

109106
type AppWithExtractedCustomFields = App & {

0 commit comments

Comments
 (0)