Skip to content

Commit c9211a8

Browse files
committed
improves value variable check
Signed-off-by: Konstantina Blazhukova <[email protected]>
1 parent c126a79 commit c9211a8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/relay/src/lib/decorators/cache.decorator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ const shouldSkipCachingForNamedParams = (args: unknown[], params: CacheNamedPara
117117
*/
118118
const generateCacheKey = (methodName: string, args: unknown[]) => {
119119
let cacheKey: string = methodName;
120-
for (const value of args) {
121-
if (value?.constructor?.name != 'RequestDetails') {
120+
for (const [, value] of Object.entries(args)) {
121+
if (!(value instanceof RequestDetails)) {
122122
if (value && typeof value === 'object') {
123123
cacheKey += `_${JSON.stringify(value)}`;
124124
continue;
@@ -142,8 +142,8 @@ const generateCacheKey = (methodName: string, args: unknown[]) => {
142142
*/
143143
const extractRequestDetails = (args: unknown[]): RequestDetails => {
144144
for (const [, value] of Object.entries(args)) {
145-
if (value?.constructor?.name === 'RequestDetails') {
146-
return value as RequestDetails;
145+
if (value instanceof RequestDetails) {
146+
return value;
147147
}
148148
}
149149

0 commit comments

Comments
 (0)