Skip to content

Commit 54aab89

Browse files
committed
fix playground
1 parent 89b4673 commit 54aab89

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/plugin/src/cache.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ export class ModuleCache<K, T> {
88
map = new Map<K, { lastSeen: [number, number]; result: T }>();
99

1010
set(cacheKey: K, result: T): void {
11+
// Remove server-side cache code in browser
12+
if (typeof window !== 'undefined') return;
13+
1114
this.map.set(cacheKey, { lastSeen: process.hrtime(), result });
1215
log('setting entry for', cacheKey);
1316
}
1417

1518
get(cacheKey: K, settings = { lifetime: 10 /* seconds */ }): T | void {
19+
// Remove server-side cache code in browser
20+
if (typeof window !== 'undefined') return;
21+
1622
const value = this.map.get(cacheKey);
1723
if (!value) {
1824
log('cache miss for', cacheKey);

website/src/components/play-page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ export function PlayPage(): ReactElement {
163163
documents={operation}
164164
selectedRules={{
165165
// @ts-expect-error -- TODO: fix type error
166-
...(schemaConfig && configs[`flat/${schemaConfig}`].rules),
166+
...(schemaConfig && configs[`flat/${schemaConfig}`]),
167167
...(schemaRule && {
168168
[`@graphql-eslint/${schemaRule}`]:
169-
configs['flat/schema-all'].rules[`@graphql-eslint/${schemaRule}`],
169+
configs['flat/schema-all'][`@graphql-eslint/${schemaRule}`],
170170
}),
171171
}}
172172
onChange={setSchema}
@@ -179,10 +179,10 @@ export function PlayPage(): ReactElement {
179179
documents={operation}
180180
selectedRules={{
181181
// @ts-expect-error -- TODO: fix type error
182-
...(operationConfig && configs[`flat/${operationConfig}`].rules),
182+
...(operationConfig && configs[`flat/${operationConfig}`]),
183183
...(operationRule && {
184184
[`@graphql-eslint/${operationRule}`]:
185-
configs['flat/operations-all'].rules[`@graphql-eslint/${operationRule}`],
185+
configs['flat/operations-all'][`@graphql-eslint/${operationRule}`],
186186
}),
187187
}}
188188
onChange={setOperation}

0 commit comments

Comments
 (0)