Skip to content

Commit

Permalink
refactor: Update package.json scripts, dependencies, and devDependenc…
Browse files Browse the repository at this point in the history
…ies for @acme/db (#40)

feat: Add updateMutation to EnglishForm component for updating English notions

refactor: Update form values in useForm for EnglishForm component

refactor: Modify import and assignment in auth/index.ts for better code readability
  • Loading branch information
vyductan authored Aug 6, 2024
1 parent d9065a4 commit 724f0aa
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion hooks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"lib": ["dom", "dom.iterable", "ES2022"],
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["."],
"include": ["*.ts", "src"],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"default": "./src/*/index.ts"
},
"./antd/*": {
"types": "./dist/src/*/index.d.ts",
"default": "./src/*/index.ts"
"types": "./dist/src/antd/*/index.d.ts",
"default": "./src/antd/*/index.ts"
},
"./pro/*": {
"types": "./dist/src/pro/*/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/alert-modal/AlertModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AlertDialogTrigger,
} from "./_components";

type AlertModalProps = Omit<ModalProps, "onOk"> & {
export type AlertModalProps = Omit<ModalProps, "onOk"> & {
onConfirm?: () => void;
};

Expand Down
32 changes: 16 additions & 16 deletions ui/src/antd/form/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ const useForm = <

const resetFields = useCallback((keepStateOptions?: KeepStateOptions) => {
if (typeof defaultValues === "function") {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
defaultValues()
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.then(
(
values:
| TFieldValues
| DefaultValues<TFieldValues>
| ((formValues: TFieldValues) => TFieldValues)
| undefined,
) => {
return methods.reset(values, keepStateOptions);
},
)
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.catch(() => void 0);
// // eslint-disable-next-line @typescript-eslint/no-unsafe-call
// defaultValues()
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// .then(
// (
// values:
// | TFieldValues
// | DefaultValues<TFieldValues>
// | ((formValues: TFieldValues) => TFieldValues)
// | undefined,
// ) => {
// return methods.reset(values, keepStateOptions);
// },
// )
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// .catch(() => void 0);
} else {
methods.reset(defaultValues, keepStateOptions);
}
Expand Down
13 changes: 6 additions & 7 deletions ui/src/form/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ const useForm = <
const resetFields = useCallback((keepStateOptions?: KeepStateOptions) => {
if (props) {
if (typeof props.defaultValues === "function") {
props
.defaultValues()
.then((values: TFieldValues) => {
return methods.reset(values, keepStateOptions);
})
.catch(() => void 0);
// props
// .defaultValues()
// .then((values: TFieldValues) => {
// return methods.reset(values, keepStateOptions);
// })
// .catch(() => void 0);
} else {
methods.reset(props.defaultValues, keepStateOptions);
}
Expand All @@ -119,7 +119,6 @@ const useForm = <
useEffect(() => {
if (
props?.onValuesChange &&
w &&
!isEqual(formInstance.formState.defaultValues, w) &&
Object.keys(w).length > 0
) {
Expand Down

0 comments on commit 724f0aa

Please sign in to comment.