Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
fix(toolkit): fix a bug when trigger pipeline, we wrongly parsed stri…
Browse files Browse the repository at this point in the history
…ng value to number (#955)

Because

- when trigger pipeline, we wrongly parsed string value to number

This commit

- fix a bug when trigger pipeline, we wrongly parsed string value to
number
  • Loading branch information
EiffelFly committed Oct 12, 2023
1 parent f1c6b38 commit be87383
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@instill-ai/toolkit",
"version": "0.68.3-rc.55",
"version": "0.68.3-rc.58",
"description": "Instill AI's frontend toolkit",
"repository": "https://github.com/instill-ai/design-system.git",
"bugs": "https://github.com/instill-ai/design-system/issues",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const StartNode = ({ data, id }: NodeProps<StartNodeData>) => {
if (!pipelineName) return;

const input = recursiveRemoveUndefinedAndNullFromArray(
recursiveReplaceNullAndEmptyStringWithUndefined(recursiveParseToNum(data))
recursiveReplaceNullAndEmptyStringWithUndefined(data)
);

setIsTriggering(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export const NumberField = (props: {
<Input.Root>
<Input.Core
{...field}
type="text"
type="number"
value={field.value ?? ""}
autoComplete="off"
// AlphaValueIssue: We still have alpha value issue in
// out design-token, so we need to use the hex value
// here
className="!text-[#1D2433] !text-opacity-80 !product-body-text-3-regular"
className="!text-[#1D2433] !text-opacity-80 !product-body-text-3-regular appearance-none"
/>
</Input.Root>
</Form.Control>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export const NumbersField = (props: {
>
<Input.Root className="flex-1">
<Input.Core
type="text"
type="number"
value={numberFieldsValue[idx] ?? undefined}
autoComplete="off"
className="text-semantic-fg-primary product-body-text-4-regular"
className="text-semantic-fg-primary product-body-text-4-regular appearance-none"
onChange={(e) => {
const newNumberFieldsValue = [...numberFieldsValue];
newNumberFieldsValue[idx] = e.target.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ export function transformStartOperatorBodyToZod(
zodSchema = zodSchema.setKey(key, z.boolean().nullable().optional());
break;
case "number":
zodSchema = zodSchema.setKey(key, z.string());
zodSchema = zodSchema.setKey(
key,
z.coerce.number().nullable().optional()
);
break;
case "number_array":
zodSchema = zodSchema.setKey(
key,
z.array(z.string().nullable().optional()).nullable().optional()
z.array(z.coerce.number().nullable().optional()).nullable().optional()
);
break;
case "audio":
Expand Down

1 comment on commit be87383

@vercel
Copy link

@vercel vercel bot commented on be87383 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.