a bug fixed
parent
5ecf47e3d1
commit
a97d4ae1a9
|
|
@ -54,7 +54,7 @@ export default function InspectorOperations({
|
||||||
}) {
|
}) {
|
||||||
const [file, setFile] = useState<File[]>([]);
|
const [file, setFile] = useState<File[]>([]);
|
||||||
const [check, setCheck] = useState<any>(false);
|
const [check, setCheck] = useState<any>(false);
|
||||||
const [charCount, setCharCount] = useState(0);
|
const [charCount, setCharCount] = useState<any>(0);
|
||||||
|
|
||||||
// Queries
|
// Queries
|
||||||
const { data, isLoading, refetch } = useQuery({
|
const { data, isLoading, refetch } = useQuery({
|
||||||
|
|
@ -132,18 +132,22 @@ export default function InspectorOperations({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add the useEffect hook to monitor changes in the description field
|
// Add the useEffect hook to monitor changes in the description field
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCharCount(form.watch("text")?.length);
|
const text = form.watch("text") as string;
|
||||||
}, [form.watch("text")]);
|
if (charCount != 0) {
|
||||||
|
setCharCount(text?.length);
|
||||||
function handleTextChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
console.log(charCount);
|
||||||
const newCharCount = event.target.value.length;
|
|
||||||
// Update charCount only when the user types or removes characters
|
|
||||||
if (newCharCount <= data?.maxTextLength) {
|
|
||||||
setCharCount(newCharCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}, [form.watch("text")]);
|
||||||
|
|
||||||
|
function handleTextChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||||
|
const newCharCount = event.target.value.length;
|
||||||
|
// Update charCount only when the user types or removes characters
|
||||||
|
if (newCharCount <= data?.maxTextLength) {
|
||||||
|
setCharCount(newCharCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
const storedData = JSON.parse(
|
const storedData = JSON.parse(
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.21",
|
"version": "0.2.22",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.21",
|
"version": "0.2.22",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^3.3.2",
|
"@hookform/resolvers": "^3.3.2",
|
||||||
"@microsoft/signalr": "^8.0.0",
|
"@microsoft/signalr": "^8.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sootzani",
|
"name": "sootzani",
|
||||||
"version": "0.2.21",
|
"version": "0.2.22",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue