Skip to content

Commit c6e22e9

Browse files
subirjollySubir Jolly
andauthored
fix: fix access of optional parameter issue (#5266)
* fix: fix access of optional parameter issue * fix: fix issue with no description Co-authored-by: Subir Jolly <sjolly@influxdata.com>
1 parent 5decfa1 commit c6e22e9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/writeData/subscriptions/components/BrokerFormContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const BrokerFormContent: FC<Props> = ({
114114
type={InputType.Text}
115115
placeholder="Describe this connection"
116116
name="description"
117-
value={formContent.description}
117+
value={formContent.description ?? ''}
118118
onChange={e =>
119119
updateForm({
120120
...formContent,

src/writeData/subscriptions/components/StringParsingForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ const StringParsingForm: FC<Props> = ({formContent, updateForm, edit}) => {
102102
>
103103
<ValidationInputWithTooltip
104104
label="Regex Pattern to find Timestamp"
105-
value={formContent.stringTimestamp.pattern}
105+
value={formContent?.stringTimestamp?.pattern}
106106
required={false}
107107
validationFunc={() =>
108-
!!formContent.stringTimestamp.pattern
108+
!!formContent?.stringTimestamp?.pattern
109109
? handleRegexValidation(formContent.stringTimestamp.pattern)
110110
: null
111111
}

src/writeData/subscriptions/utils/form.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ const checkStringObjRequiredFields = (
250250
validateRegex(stringObjParams?.pattern)
251251

252252
const checkStringTimestamp = (stringObjParams: StringObjectParams): boolean => {
253-
if (!stringObjParams.pattern) {
253+
if (!stringObjParams?.pattern) {
254254
return true
255255
}
256256
return validateRegex(stringObjParams.pattern)
@@ -272,7 +272,7 @@ const checkJsonObjRequiredFields = (jsonObjParams: JsonSpec): boolean =>
272272
validateJsonPath(jsonObjParams.path)
273273

274274
const checkJsonTimestamp = (jsonObjParams: JsonSpec): boolean => {
275-
if (!jsonObjParams.path) {
275+
if (!jsonObjParams?.path) {
276276
return true
277277
}
278278
return validateJsonPath(jsonObjParams.path)

0 commit comments

Comments
 (0)