fix: use optional chaining to fix lint errors (#1485)
This commit is contained in:
parent
146b3cb8cf
commit
d25b71c0a1
3 changed files with 3 additions and 3 deletions
|
|
@ -162,7 +162,7 @@ function PureArtifact({
|
||||||
|
|
||||||
const currentDocument = currentDocuments.at(-1);
|
const currentDocument = currentDocuments.at(-1);
|
||||||
|
|
||||||
if (!currentDocument || !currentDocument.content) {
|
if (!currentDocument?.content) {
|
||||||
setIsContentDirty(false);
|
setIsContentDirty(false);
|
||||||
return currentDocuments;
|
return currentDocuments;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export const requestSuggestions = ({
|
||||||
execute: async ({ documentId }) => {
|
execute: async ({ documentId }) => {
|
||||||
const document = await getDocumentById({ id: documentId });
|
const document = await getDocumentById({ id: documentId });
|
||||||
|
|
||||||
if (!document || !document.content) {
|
if (!document?.content) {
|
||||||
return {
|
return {
|
||||||
error: "Document not found",
|
error: "Document not found",
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export const handleTransaction = ({
|
||||||
editorRef: MutableRefObject<EditorView | null>;
|
editorRef: MutableRefObject<EditorView | null>;
|
||||||
onSaveContent: (updatedContent: string, debounce: boolean) => void;
|
onSaveContent: (updatedContent: string, debounce: boolean) => void;
|
||||||
}) => {
|
}) => {
|
||||||
if (!editorRef || !editorRef.current) {
|
if (!editorRef?.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue