Skip to content

Commit 2fe8e19

Browse files
committed
Remove unnecessary useMemo.
1 parent cb6a82d commit 2fe8e19

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/plugins/es_ui_shared/public/request/use_request.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { useEffect, useState, useRef, useMemo } from 'react';
20+
import { useEffect, useState, useRef } from 'react';
2121

2222
import { HttpSetup } from '../../../../../src/core/public';
2323
import { sendRequest, SendRequestConfig, SendRequestResponse } from './send_request';
@@ -115,15 +115,13 @@ export const useRequest = <D = any, E = Error>(
115115
return { data: serializedResponseData, error: responseError };
116116
};
117117

118-
const stringifiedQuery = useMemo(() => JSON.stringify(query), [query]);
119-
120118
useEffect(() => {
121119
sendRequestRef.current!();
122120

123121
// To be functionally correct we'd send a new request if the method, path, query or body changes.
124122
// But it doesn't seem likely that the method will change and body is likely to be a new
125123
// object even if its shape hasn't changed, so for now we're just watching the path and the query.
126-
}, [path, stringifiedQuery]);
124+
}, [path, query]);
127125

128126
useEffect(() => {
129127
scheduleRequestRef.current!();

0 commit comments

Comments
 (0)