Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rojiphil committed Sep 27, 2024
1 parent ea0cfb5 commit a59988b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/pages/workspace/WorkspaceInviteMessagePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {StackScreenProps} from '@react-navigation/stack';
import lodashDebounce from 'lodash/debounce';
import React, {useEffect, useMemo, useState} from 'react';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {Keyboard, View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
Expand Down Expand Up @@ -60,16 +60,19 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}:
[policy?.name, currentUserPersonalDetails?.displayName],
);

const getDefaultWelcomeNote = () =>
// workspaceInviteMessageDraft can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
workspaceInviteMessageDraft ||
// policy?.description can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Parser.htmlToMarkdown(policy?.description ?? '') ||
translate('workspace.common.welcomeNote', {
workspaceName: policy?.name ?? '',
});
const getDefaultWelcomeNote = useCallback(() => {
return (
// workspaceInviteMessageDraft can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
workspaceInviteMessageDraft ||
// policy?.description can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Parser.htmlToMarkdown(policy?.description ?? '') ||
translate('workspace.common.welcomeNote', {
workspaceName: policy?.name ?? '',
})
);
}, [workspaceInviteMessageDraft, policy, translate]);

useEffect(() => {
if (!isEmptyObject(invitedEmailsToAccountIDsDraft)) {
Expand All @@ -88,7 +91,7 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}:
return;
}
setWelcomeNote(getDefaultWelcomeNote());
}, [invitedEmailsToAccountIDsDraft, workspaceInviteMessageDraft, route.params.policyID, policy]);
}, [getDefaultWelcomeNote, invitedEmailsToAccountIDsDraft]);

const debouncedSaveDraft = lodashDebounce((newDraft: string | null) => {
Policy.setWorkspaceInviteMessageDraft(route.params.policyID, newDraft);
Expand Down

0 comments on commit a59988b

Please sign in to comment.