Skip to content

Commit 232e8f7

Browse files
committed
remove connect method
1 parent 96ca062 commit 232e8f7

5 files changed

Lines changed: 18 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4747
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4848
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
49-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=319 --cache --cache-location=node_modules/.cache/eslint",
49+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=318 --cache --cache-location=node_modules/.cache/eslint",
5050
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
5151
"lint-watch": "npx eslint-watch --watch --changed",
5252
"shellcheck": "./scripts/shellCheck.sh",

src/libs/actions/Task.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ Onyx.connect({
5959
callback: (value) => (allPersonalDetails = value),
6060
});
6161

62-
let quickAction: OnyxEntry<OnyxTypes.QuickAction> = {};
63-
Onyx.connect({
64-
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
65-
callback: (value) => {
66-
quickAction = value;
67-
},
68-
});
69-
7062
let allReportActions: OnyxCollection<ReportActions>;
7163
Onyx.connect({
7264
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
@@ -142,6 +134,7 @@ function createTaskAndNavigate(
142134
assigneeChatReport?: OnyxEntry<OnyxTypes.Report>,
143135
policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE,
144136
isCreatedUsingMarkdown = false,
137+
quickAction: OnyxEntry<OnyxTypes.QuickAction> = {},
145138
) {
146139
if (!parentReportID) {
147140
return;

src/pages/home/report/ReportFooter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function ReportFooter({
9494
const {shouldUseNarrowLayout} = useResponsiveLayout();
9595

9696
const [shouldShowComposeInput = false] = useOnyx(ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT, {canBeMissing: true});
97+
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
9798
const [isAnonymousUser = false] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.authTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS, canBeMissing: false});
9899
const [isBlockedFromChat] = useOnyx(ONYXKEYS.NVP_BLOCKED_FROM_CHAT, {
99100
selector: (dateString) => {
@@ -163,7 +164,7 @@ function ReportFooter({
163164
title = `@${mentionWithDomain} ${title}`;
164165
}
165166
}
166-
createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID, true);
167+
createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID, true, quickAction);
167168
return true;
168169
},
169170
[allPersonalDetails, availableLoginsList, currentUserEmail, report.policyID, report.reportID],

src/pages/tasks/NewTaskDetailsPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type NewTaskDetailsPageProps = PlatformStackScreenProps<NewTaskNavigatorParamLis
2828

2929
function NewTaskDetailsPage({route}: NewTaskDetailsPageProps) {
3030
const [task] = useOnyx(ONYXKEYS.TASK, {canBeMissing: true});
31+
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
3132
const styles = useThemeStyles();
3233
const {translate} = useLocalize();
3334
const [taskTitle, setTaskTitle] = useState(task?.title ?? '');
@@ -70,7 +71,7 @@ function NewTaskDetailsPage({route}: NewTaskDetailsPageProps) {
7071

7172
if (skipConfirmation) {
7273
setShareDestinationValue(task?.parentReportID);
73-
createTaskAndNavigate(task?.parentReportID, values.taskTitle, values.taskDescription ?? '', task?.assignee ?? '', task.assigneeAccountID, task.assigneeChatReport);
74+
createTaskAndNavigate(task?.parentReportID, values.taskTitle, values.taskDescription ?? '', task?.assignee ?? '', task.assigneeAccountID, task.assigneeChatReport, CONST.POLICY.OWNER_EMAIL_FAKE, false, quickAction);
7475
} else {
7576
Navigation.navigate(ROUTES.NEW_TASK.getRoute(backTo));
7677
}

src/pages/tasks/NewTaskPage.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function NewTaskPage({route}: NewTaskPageProps) {
3232
const [task] = useOnyx(ONYXKEYS.TASK, {canBeMissing: true});
3333
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
3434
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false});
35+
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
3536
const styles = useThemeStyles();
3637
const {translate, formatPhoneNumber} = useLocalize();
3738
const assignee = useMemo(() => getAssignee(task?.assigneeAccountID ?? CONST.DEFAULT_NUMBER_ID, personalDetails), [task?.assigneeAccountID, personalDetails]);
@@ -91,7 +92,17 @@ function NewTaskPage({route}: NewTaskPageProps) {
9192
return;
9293
}
9394

94-
createTaskAndNavigate(parentReport?.reportID, task.title, task?.description ?? '', task?.assignee ?? '', task.assigneeAccountID, task.assigneeChatReport, parentReport?.policyID);
95+
createTaskAndNavigate(
96+
parentReport?.reportID,
97+
task.title,
98+
task?.description ?? '',
99+
task?.assignee ?? '',
100+
task.assigneeAccountID,
101+
task.assigneeChatReport,
102+
parentReport?.policyID,
103+
false,
104+
quickAction,
105+
);
95106
};
96107

97108
return (

0 commit comments

Comments
 (0)