Handle promise linting (#5488)
This commit is contained in:
@@ -99,7 +99,7 @@ function SharedDocumentScene(props: Props) {
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!auth.user) {
|
||||
changeLanguage(detectLanguage(), i18n);
|
||||
void changeLanguage(detectLanguage(), i18n);
|
||||
}
|
||||
}, [auth, i18n]);
|
||||
|
||||
@@ -125,7 +125,7 @@ function SharedDocumentScene(props: Props) {
|
||||
setError(err);
|
||||
}
|
||||
}
|
||||
fetchData();
|
||||
void fetchData();
|
||||
}, [documents, documentSlug, shareId, ui]);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -69,14 +69,14 @@ function CommentForm({
|
||||
const { comments } = useStores();
|
||||
const user = useCurrentUser();
|
||||
|
||||
const reset = React.useCallback(() => {
|
||||
const reset = React.useCallback(async () => {
|
||||
const isEmpty = editorRef.current?.isEmpty() ?? true;
|
||||
|
||||
if (isEmpty && thread?.isNew) {
|
||||
if (thread.id) {
|
||||
editor?.removeComment(thread.id);
|
||||
}
|
||||
thread.delete();
|
||||
await thread.delete();
|
||||
}
|
||||
}, [editor, thread]);
|
||||
|
||||
@@ -173,11 +173,11 @@ function CommentForm({
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
const handleCancel = async () => {
|
||||
setData(undefined);
|
||||
setForceRender((s) => ++s);
|
||||
setInputFocused(false);
|
||||
reset();
|
||||
await reset();
|
||||
};
|
||||
|
||||
const handleFocus = () => {
|
||||
|
||||
@@ -114,7 +114,7 @@ function CommentThread({
|
||||
if (!topRef.current) {
|
||||
return;
|
||||
}
|
||||
scrollIntoView(topRef.current, {
|
||||
return scrollIntoView(topRef.current, {
|
||||
scrollMode: "if-needed",
|
||||
behavior: "smooth",
|
||||
block: "end",
|
||||
|
||||
@@ -86,7 +86,7 @@ function DataLoader({ match, children }: Props) {
|
||||
setError(err);
|
||||
}
|
||||
}
|
||||
fetchDocument();
|
||||
void fetchDocument();
|
||||
}, [ui, documents, document, shareId, documentSlug]);
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -99,7 +99,7 @@ function DataLoader({ match, children }: Props) {
|
||||
}
|
||||
}
|
||||
}
|
||||
fetchRevision();
|
||||
void fetchRevision();
|
||||
}, [revisions, revisionId]);
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -112,7 +112,7 @@ function DataLoader({ match, children }: Props) {
|
||||
}
|
||||
}
|
||||
}
|
||||
fetchRevision();
|
||||
void fetchRevision();
|
||||
}, [document, revisionId, revisions]);
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -128,7 +128,7 @@ function DataLoader({ match, children }: Props) {
|
||||
}
|
||||
}
|
||||
}
|
||||
fetchSubscription();
|
||||
void fetchSubscription();
|
||||
}, [document?.id, subscriptions, revisionId]);
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -143,7 +143,7 @@ function DataLoader({ match, children }: Props) {
|
||||
}
|
||||
}
|
||||
}
|
||||
fetchViews();
|
||||
void fetchViews();
|
||||
}, [document?.id, document?.isDeleted, revisionId, views]);
|
||||
|
||||
const onCreateLink = React.useCallback(
|
||||
@@ -180,7 +180,7 @@ function DataLoader({ match, children }: Props) {
|
||||
// when viewing a public share link
|
||||
if (can.read) {
|
||||
if (team?.getPreference(TeamPreference.Commenting)) {
|
||||
comments.fetchDocumentComments(document.id, {
|
||||
void comments.fetchDocumentComments(document.id, {
|
||||
limit: 100,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
this.props.document.hasEmptyTitle &&
|
||||
this.props.document.isPersistedOnce
|
||||
) {
|
||||
this.props.document.delete();
|
||||
void this.props.document.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,8 @@ class DocumentScene extends React.Component<Props> {
|
||||
|
||||
this.props.document.text = template.text;
|
||||
this.updateIsDirty();
|
||||
this.onSave({
|
||||
|
||||
return this.onSave({
|
||||
autosave: true,
|
||||
publish: false,
|
||||
done: false,
|
||||
@@ -189,7 +190,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
});
|
||||
|
||||
if (response) {
|
||||
this.replaceDocument(response.data);
|
||||
await this.replaceDocument(response.data);
|
||||
toasts.showToast(t("Document restored"));
|
||||
history.replace(this.props.document.url, history.location.state);
|
||||
}
|
||||
@@ -244,7 +245,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
}
|
||||
|
||||
if (document?.collectionId) {
|
||||
this.onSave({
|
||||
void this.onSave({
|
||||
publish: true,
|
||||
done: true,
|
||||
});
|
||||
@@ -324,12 +325,14 @@ class DocumentScene extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
autosave = debounce(() => {
|
||||
this.onSave({
|
||||
done: false,
|
||||
autosave: true,
|
||||
});
|
||||
}, AUTOSAVE_DELAY);
|
||||
autosave = debounce(
|
||||
() =>
|
||||
this.onSave({
|
||||
done: false,
|
||||
autosave: true,
|
||||
}),
|
||||
AUTOSAVE_DELAY
|
||||
);
|
||||
|
||||
updateIsDirty = () => {
|
||||
const { document } = this.props;
|
||||
@@ -370,7 +373,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
this.title = value;
|
||||
this.props.document.title = value;
|
||||
this.updateIsDirty();
|
||||
this.autosave();
|
||||
void this.autosave();
|
||||
});
|
||||
|
||||
goBack = () => {
|
||||
|
||||
@@ -220,7 +220,7 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isLocalSynced && isRemoteSynced) {
|
||||
onSynced?.();
|
||||
void onSynced?.();
|
||||
}
|
||||
}, [onSynced, isLocalSynced, isRemoteSynced]);
|
||||
|
||||
@@ -236,14 +236,14 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
|
||||
!isVisible &&
|
||||
remoteProvider.status === WebSocketStatus.Connected
|
||||
) {
|
||||
remoteProvider.disconnect();
|
||||
void remoteProvider.disconnect();
|
||||
}
|
||||
|
||||
if (
|
||||
(!isIdle || isVisible) &&
|
||||
remoteProvider.status === WebSocketStatus.Disconnected
|
||||
) {
|
||||
remoteProvider.connect();
|
||||
void remoteProvider.connect();
|
||||
}
|
||||
}, [remoteProvider, isIdle, isVisible]);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ function References({ document }: Props) {
|
||||
const location = useLocation();
|
||||
|
||||
React.useEffect(() => {
|
||||
documents.fetchBacklinks(document.id);
|
||||
void documents.fetchBacklinks(document.id);
|
||||
}, [documents, document.id]);
|
||||
|
||||
const backlinks = documents.getBacklinkedDocuments(document.id);
|
||||
|
||||
@@ -76,7 +76,7 @@ function SharePopover({
|
||||
|
||||
React.useEffect(() => {
|
||||
if (visible && team.sharing) {
|
||||
document.share();
|
||||
void document.share();
|
||||
buttonRef.current?.focus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user