From 9deb8ceb78e5fe9a88e63bba2d8c7fb188684d26 Mon Sep 17 00:00:00 2001 From: robin Date: Fri, 14 Oct 2022 14:10:45 +0800 Subject: [PATCH] fix: fix problems caused by uncontrolled components --- ui/src/common/interface.ts | 2 +- .../Comment/components/Form/index.tsx | 6 +++-- .../Comment/components/Reply/index.tsx | 7 +++++- ui/src/components/Mentions/index.tsx | 23 ++++++++----------- ui/src/hooks/usePageUsers/index.tsx | 8 +++---- ui/src/pages/Questions/Detail/index.tsx | 11 ++++++++- 6 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ui/src/common/interface.ts b/ui/src/common/interface.ts index 08d206f2..73eac5d4 100644 --- a/ui/src/common/interface.ts +++ b/ui/src/common/interface.ts @@ -195,7 +195,7 @@ export interface PostAnswerReq { } export interface PageUser { - id; + id?; displayName; userName?; avatar_url?; diff --git a/ui/src/components/Comment/components/Form/index.tsx b/ui/src/components/Comment/components/Form/index.tsx index a67f8aca..4971c4ef 100644 --- a/ui/src/components/Comment/components/Form/index.tsx +++ b/ui/src/components/Comment/components/Form/index.tsx @@ -29,7 +29,9 @@ const Form = ({ const handleChange = (e) => { setValue(e.target.value); }; - + const handleSelected = (val) => { + setValue(val); + }; return (
- +