Skip to content

Commit 94aa306

Browse files
committed
Fix cache invalidation error on user name change
1 parent fd6f5f0 commit 94aa306

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

app/(dashboard)/dashboard/general/page.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use client";
22

33
import { Loader2 } from "lucide-react";
4-
import { Suspense, useActionState } from "react";
5-
import useSWR from "swr";
4+
import { Suspense, useActionState, useEffect } from "react";
5+
import useSWR, { mutate } from "swr";
66
import { updateAccount } from "@/app/(login)/actions";
77
import { Button } from "@/components/ui/button";
88
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
@@ -77,6 +77,15 @@ export default function GeneralPage() {
7777
{},
7878
);
7979

80+
// Invalidate team cache when account is successfully updated
81+
useEffect(() => {
82+
if (state?.success) {
83+
// Invalidate both user and team caches since team data includes user info
84+
mutate("/api/user");
85+
mutate("/api/team");
86+
}
87+
}, [state?.success]);
88+
8089
return (
8190
<section className="flex-1 p-4 lg:p-8">
8291
<h1 className="text-lg lg:text-2xl font-medium text-gray-900 mb-6">

tutorial/stage-2-generated-tests/generate-tests-playwright-mcp.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ Instead, here's a list of bugs we fixed to give you an idea of the kinds of prob
419419
- Users couldn't not be deleted when activities existed, foreign key constraint
420420
- The user menu wouldn't collapse on click
421421
- Updating the user name wouldn't update the user menu name icon
422+
- Updating the user name wouldn't update the user menu name team members list
422423
- Not possible to update the email without updating the name
423424
- Hydration errors on the choose plan page
424425

tutorial/stage-3-endform-integration/speeding-up-with-endform.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ To start from this step, checkout the [`stage-2-generated-tests` branch](https:/
1414
For more information about getting started with the tutorial repository, go [here](/docs/tutorial/from-cowboy-to-confidence#getting-started-with-the-tutorial-repository).
1515
</Aside>
1616

17-
<Aside type="caution">
18-
This tutorial is a work in progress! More coming soon.
19-
</Aside>
17+
At this point in time, we have a pretty decent Playwriht end to end testing suite that can test most of the dummy features in this application.
18+
We can test complex multi user flows like inviting, and we have the ability to create new users on demand when the user data conflicts with other tests.

0 commit comments

Comments
 (0)