Skip to content

Commit a9d634e

Browse files
author
hsjeong
committed
feat: apollo cache clear by story
1 parent 21bcce5 commit a9d634e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.storybook/preview.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Preview } from "@storybook/react-vite";
55
import { initialize, mswLoader } from "msw-storybook-addon";
66
import { useEffect } from "react";
77
import React from "react";
8+
import { client } from "../src/api/infra/gitHub/gitHubClient";
89

910
// Initialize MSW
1011
initialize();
@@ -28,6 +29,8 @@ const preview: Preview = {
2829
(Story, context) => {
2930
const QueryParamsDecorator = () => {
3031
useEffect(() => {
32+
client.cache.reset();
33+
3134
const queryParams = context.parameters?.query;
3235
if (queryParams && typeof queryParams === "object") {
3336
const url = new URL(window.location.href);

src/api/infra/gitHub/gitHubClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const client = new ApolloClient({
55
cache: new InMemoryCache(),
66
});
77

8+
export { client };
9+
810
export interface GitHubTeam {
911
name: string;
1012
}

0 commit comments

Comments
 (0)