Skip to content

Commit ebe3982

Browse files
Fix: Persist selected team to localStorage and restore on page refresh
- Added localStorage check in initTeam useEffect to restore previously uploaded team - Added TeamService.storageTeam() call in handleTeamUpload to persist team selection - Now when user refreshes the page, the uploaded team remains selected instead of reverting to 'no team selected'
1 parent a452478 commit ebe3982

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

content_packs/content_gen/agent_teams/content_gen.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "1",
3-
"team_id": "content-gen-team",
4-
"name": "Retail Marketing Content Generation Team",
3+
"team_id": "content-gen-team123",
4+
"name": "Retail Marketing Content Generation Team123",
55
"status": "visible",
66
"created": "",
77
"created_by": "",

content_packs/contract_compliance/agent_teams/desktop.ini

Whitespace-only changes.

src/App/src/pages/HomePage.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ const HomePage: React.FC = () => {
3535
const initTeam = async () => {
3636
dispatch(setIsLoadingTeam(true));
3737
try {
38+
// Check localStorage first for a previously uploaded team
39+
const storedTeam = TeamService.getStoredTeam();
40+
if (storedTeam) {
41+
dispatch(setSelectedTeam(storedTeam));
42+
showToast(`${storedTeam.name} team restored from previous session`, 'success');
43+
dispatch(setIsLoadingTeam(false));
44+
return;
45+
}
46+
3847
const initResponse = await TeamService.initializeTeam();
3948

4049
if (initResponse.data?.status === 'Request started successfully' && initResponse.data?.team_id) {
@@ -124,6 +133,7 @@ const HomePage: React.FC = () => {
124133
if (uploadedTeam) {
125134
const teamName = uploadedTeam.name || 'Uploaded Team';
126135
dispatch(setSelectedTeam(uploadedTeam));
136+
TeamService.storageTeam(uploadedTeam);
127137
showToast(`Default team set to ${teamName}`, 'success');
128138
} else {
129139
console.warn('No uploaded team provided to handleTeamUpload');

uv.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)