Skip to content

Commit 1ca29ab

Browse files
authored
fix: check if timestamp exists (#4639)
1 parent ce128c5 commit 1ca29ab

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/writeData/subscriptions/components/JsonParsingForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const JsonParsingForm: FC<Props> = ({formContent, updateForm, edit}) => {
7777
placeholder="eg. $.myJSON.myObject[0].timestampKey"
7878
name="timestamp"
7979
autoFocus={true}
80-
value={formContent.jsonTimestamp.path}
80+
value={formContent.jsonTimestamp?.path}
8181
onChange={e => {
8282
updateForm({
8383
...formContent,

src/writeData/subscriptions/utils/form.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ export const sanitizeUpdateForm = (form: Subscription): Subscription => {
122122
if (newVal) {
123123
form.jsonTimestamp.path = newVal
124124
}
125+
if (!form.jsonTimestamp?.name) {
126+
form.jsonTimestamp.name = 'timestamp'
127+
}
128+
if (!form.jsonTimestamp?.type) {
129+
form.jsonTimestamp.type = 'string'
130+
}
125131
}
126132
delete form.id
127133
delete form.orgID

0 commit comments

Comments
 (0)