Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

clear storage on StoryWrapper mount

ThieryMichel791a1fbc82d1
diff --git a/src/components/atomic-crm/contacts/ContactEdit.mobile.stories.tsx b/src/components/atomic-crm/contacts/ContactEdit.mobile.stories.tsx
index 782ef1d5..5ca46687 100644
--- a/src/components/atomic-crm/contacts/ContactEdit.mobile.stories.tsx
+++ b/src/components/atomic-crm/contacts/ContactEdit.mobile.stories.tsx
@@ -25,7 +25,7 @@ export const ContactEditBasic = ({
silent?: boolean;
}) => (
<StoryWrapper
- initialEntries={["/contacts/create"]}
+ initialEntries={["/contacts/1/show"]}
data={{
contacts: [
buildContact({
@@ -52,7 +52,7 @@ export const ContactEditWithEmailsAndPhones = ({
silent?: boolean;
}) => (
<StoryWrapper
- initialEntries={["/contacts/create"]}
+ initialEntries={["/contacts/1/show"]}
data={{
contacts: [
buildContact({
diff --git a/src/test/StoryWrapper.tsx b/src/test/StoryWrapper.tsx
index e5459427..74a6f70e 100644
--- a/src/test/StoryWrapper.tsx
+++ b/src/test/StoryWrapper.tsx
@@ -100,7 +100,7 @@ export const StoryWrapper = ({
const store = useMemo(() => memoryStore(), []);
useEffect(() => {
- // Clear localStorage on mount to prevent test pollution from previous runs, since MemoryRouter doesn't reset state between tests.
+ // Clear localStorage on mount to prevent data pollution from previous story / test, since we persist react-query cache in localStorage.
localStorage.clear();
}, []);
diff --git a/src/test/setup.ts b/src/test/setup.ts
deleted file mode 100644
index 055ae536..00000000
--- a/src/test/setup.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import "vitest-browser-react";
-
-// MobileAdmin uses PersistQueryClientProvider backed by localStorage.
-// Clear it before each test so stale query cache never leaks across tests.
-beforeEach(() => {
- localStorage.clear();
-});
diff --git a/vitest.config.ts b/vitest.config.ts
index e4b21038..4107426d 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -7,7 +7,6 @@ export default defineConfig({
plugins: [react()],
test: {
globals: true,
- setupFiles: ["./src/test/setup.ts"],
browser: {
provider: playwright(),
enabled: true,