fix: use optional chaining to fix lint errors (#1485)

This commit is contained in:
Vincent Voyer 2026-04-16 18:43:22 +02:00 committed by GitHub
parent 146b3cb8cf
commit d25b71c0a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -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;
} }

View file

@ -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",
}; };

View file

@ -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;
} }