Open Rahul04128 opened 3 years ago
me too
The #1044 is fixing this.
any idea of an eta about when this should be merged?
Hi, I'm also getting this error. When I opened the page I got this error. I've added condition before Editor loading, the error was gone. But when I returned the previous page by clicking Cancel(can be found at the following code) the error is occurring. What is wrong with this code? Any help is appreciated.
Thnx
My Code;
import React, { useState, useEffect, useCallback } from "react";
import "../styles/Pages.css";
import { useLocation, Link } from "react-router-dom";
import { API } from "@aws-amplify/api";
import "draft-js/dist/Draft.css";
import { Editor } from "react-draft-wysiwyg";
import { EditorState, ContentState } from "draft-js";
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
const TDetails = (props) => {
const [tacState, setTacState] = useState(null);
const createWithContent = useCallback(
(param) => EditorState.createWithContent(param),
[]
);
const createEmpty = useCallback(() => EditorState.createEmpty(), []);
const createFromText = useCallback(
(param) => ContentState.createFromText(param),
[]
);
const getTacInfo = useCallback(
async (e) => {
try {
setTacState(createEmpty);
const tacInfo = await API.graphql({
query: xxxx,
variables: { xxxx },
});
setTacState(
createWithContent(
createFromText(xxxx)
)
);
} catch (error) {
console.log("error occured on fetch version :", error);
}
},
[xxx, createWithContent, createFromText, createEmpty]
);
useEffect(() => {
getTacInfo();
return () => {
setTacState(null);
};
}, [getTacInfo]);
return (
<>
{tacState && (
<Editor
editorState={tacState}
toolbarClassName="toolbarClassName"
wrapperClassName="wrapperClassName"
editorClassName="editorClassName"
readOnly={"true"}
/>
)}
<Link
className="btn secondary marginTop-20 marginLeft-20"
to={{
pathname: "/",
}}>
{" "}
Cancel{" "}
</>
);
};
export default TDetails;
Errors;
any solution?
anywhere i click on screen i get this this error