Skip to content

Commit 4cd3d39

Browse files
committed
hide default blank row for custom headers
1 parent 9c0e5ce commit 4cd3d39

File tree

7 files changed

+11
-3
lines changed

7 files changed

+11
-3
lines changed

packages/backend/src/apps/custom-api/actions/http-request/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const action: IRawAction = {
5454
description: 'Add custom headers here.',
5555
variables: true,
5656
customButtonText: 'Add',
57+
hideBlankRow: true,
5758
showDivider: false,
5859
subFields: [
5960
{

packages/backend/src/apps/custom-api/actions/http-request/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export const requestSchema = z.object({
66
customHeaders: z
77
.array(
88
z.object({
9-
key: z.string().trim().min(1, 'Key empty').nullish(),
10-
value: z.string().trim().min(1, 'Value empty').nullish(),
9+
key: z.string().trim().min(1, 'Key empty'),
10+
value: z.string().trim().min(1, 'Value empty'),
1111
}),
1212
)
1313
.transform((params, context) => {

packages/backend/src/graphql/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ type ActionSubstepArgument {
190190
hiddenIf: FieldVisibilityCondition
191191
customButtonText: String
192192
customStyle: JSONObject
193+
hideBlankRow: Boolean
193194
showDivider: Boolean
194195
isSingleLine: Boolean
195196

packages/frontend/src/components/InputCreator/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export default function InputCreator(props: InputCreatorProps): JSX.Element {
161161
subFields={schema.subFields}
162162
required={required}
163163
customButtonText={schema.customButtonText}
164+
hideBlankRow={schema.hideBlankRow}
164165
showDivider={schema.showDivider}
165166
type={type}
166167
// These are InputCreatorProps which MultiRow will forward.

packages/frontend/src/components/MultiRow/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type MultiRowProps = {
2121
label?: string
2222
description?: string
2323
flexDir?: string
24+
hideBlankRow?: boolean
2425
showDivider?: boolean
2526
customButtonText?: string
2627
type?: string
@@ -34,6 +35,7 @@ function MultiRow(props: MultiRowProps): JSX.Element {
3435
required,
3536
description,
3637
customButtonText,
38+
hideBlankRow,
3739
showDivider,
3840
type,
3941
...forwardedInputCreatorProps
@@ -72,7 +74,7 @@ function MultiRow(props: MultiRowProps): JSX.Element {
7274
<Controller
7375
name={name}
7476
control={control}
75-
defaultValue={[{ ...newRowDefaultValue }]}
77+
defaultValue={hideBlankRow ? [] : [{ ...newRowDefaultValue }]}
7678
render={({ field: { value: fallbackRows } }): JSX.Element => {
7779
// HACKFIX (ogp-weeloong): I don't know why `rows` lags behind
7880
// `fallbackRows` on the 1st render.

packages/frontend/src/graphql/queries/get-apps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ export const GET_APPS = gql`
190190
allowArbitrary
191191
customButtonText
192192
customStyle
193+
hideBlankRow
193194
showDivider
194195
showOptionValue
195196
isSingleLine

packages/types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ export interface IFieldMultiRowMultiCol extends IBaseField {
358358
type: 'multirow-multicol'
359359
value?: string
360360
customButtonText?: string
361+
hideBlankRow?: boolean
361362
showDivider?: boolean
362363

363364
subFields: IField[]
@@ -367,6 +368,7 @@ export interface IFieldMultiRow extends IBaseField {
367368
type: 'multirow'
368369
value?: string
369370
customButtonText?: string
371+
hideBlankRow?: boolean
370372
showDivider?: boolean
371373

372374
subFields: IField[]

0 commit comments

Comments
 (0)