Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc7bf5f

Browse files
committed
refactor(isr): correction cache typo
1 parent 5111840 commit bc7bf5f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libs/isr/server/src/isr-handler.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ export class ISRHandler {
8080
const { cacheKey, url, reqSimulator } = variantUrl;
8181

8282
// check if the url is in cache
83-
const urlExists = await this.cache.has(cachKey);
83+
const urlExists = await this.cache.has(cacheKey);
8484

8585
if (!urlExists) {
86-
notInCache.push(cachKey);
86+
notInCache.push(cacheKey);
8787
continue;
8888
}
8989

@@ -102,24 +102,24 @@ export class ISRHandler {
102102

103103
// if there are errors when rendering the site we throw an error
104104
if (errors?.length && this.config.skipCachingOnHttpError) {
105-
urlWithErrors[cachKey] = errors;
105+
urlWithErrors[cacheKey] = errors;
106106
}
107107

108108
// add the regenerated page to cache
109109
const cacheConfig: CacheISRConfig = {
110110
revalidate,
111111
buildId: this.config.buildId,
112112
};
113-
await this.cache.add(cachKey, html, cacheConfig);
113+
await this.cache.add(cacheKey, html, cacheConfig);
114114
} catch (err) {
115-
urlWithErrors[cachKey] = err;
115+
urlWithErrors[cacheKey] = err;
116116
}
117117
}
118118

119119
const invalidatedUrls = variantUrlsToInvalidate
120-
.map((val) => val.cachKey)
120+
.map((val) => val.cacheKey)
121121
.filter(
122-
(cachKey) => !notInCache.includes(cachKey) && !urlWithErrors[cachKey]
122+
(cacheKey) => !notInCache.includes(cacheKey) && !urlWithErrors[cacheKey]
123123
);
124124

125125
if (notInCache.length) {
@@ -156,11 +156,11 @@ export class ISRHandler {
156156
const defaultVariant = (req: Request) => req;
157157

158158
for (const url of urlsToInvalidate) {
159-
result.push({ url, cachKey: url, reqSimulator: defaultVariant });
159+
result.push({ url, cacheKey: url, reqSimulator: defaultVariant });
160160
for (const variant of variants) {
161161
result.push({
162162
url,
163-
cachKey: getCacheKey(url, variant),
163+
cacheKey: getCacheKey(url, variant),
164164
reqSimulator: variant.simulateVariant
165165
? variant.simulateVariant
166166
: defaultVariant,

0 commit comments

Comments
 (0)