|
1 | 1 | import {getReportChatType} from '@selectors/Report'; |
2 | | -import React, {createContext, useCallback, useContext, useEffect, useMemo, useState} from 'react'; |
| 2 | +import React, {createContext, useContext, useEffect, useState} from 'react'; |
3 | 3 | import useOnyx from '@hooks/useOnyx'; |
4 | 4 | import {getReportChannelName} from '@libs/actions/Report'; |
5 | 5 | import Log from '@libs/Log'; |
@@ -56,9 +56,9 @@ function ConciergeDraftProvider({reportID, children}: React.PropsWithChildren<{r |
56 | 56 | function ConciergeDraftGate({reportID, children}: React.PropsWithChildren<{reportID: string}>) { |
57 | 57 | const [draft, setDraft] = useState<ConciergeDraft | null>(null); |
58 | 58 |
|
59 | | - const clearDraft = useCallback(() => { |
| 59 | + const clearDraft = () => { |
60 | 60 | setDraft(null); |
61 | | - }, []); |
| 61 | + }; |
62 | 62 |
|
63 | 63 | useEffect(() => { |
64 | 64 | const channelName = getReportChannelName(reportID); |
@@ -98,20 +98,14 @@ function ConciergeDraftGate({reportID, children}: React.PropsWithChildren<{repor |
98 | 98 | }; |
99 | 99 | }, [clearDraft, reportID]); |
100 | 100 |
|
101 | | - const stateValue = useMemo<ConciergeDraftState>( |
102 | | - () => ({ |
103 | | - draftReportAction: draft?.reportAction ?? null, |
104 | | - hasActiveDraft: !!draft?.reportAction, |
105 | | - }), |
106 | | - [draft?.reportAction], |
107 | | - ); |
| 101 | + const stateValue: ConciergeDraftState = { |
| 102 | + draftReportAction: draft?.reportAction ?? null, |
| 103 | + hasActiveDraft: !!draft?.reportAction, |
| 104 | + }; |
108 | 105 |
|
109 | | - const actionsValue = useMemo<ConciergeDraftActions>( |
110 | | - () => ({ |
111 | | - clearDraft, |
112 | | - }), |
113 | | - [clearDraft], |
114 | | - ); |
| 106 | + const actionsValue: ConciergeDraftActions = { |
| 107 | + clearDraft, |
| 108 | + }; |
115 | 109 |
|
116 | 110 | return ( |
117 | 111 | <ConciergeDraftActionsContext.Provider value={actionsValue}> |
|
0 commit comments