fix: Enhance TeamSelector and HomePage with team upload persistence#1065
Open
Harmanpreet-Microsoft wants to merge 5 commits into
Open
fix: Enhance TeamSelector and HomePage with team upload persistence#1065Harmanpreet-Microsoft wants to merge 5 commits into
Harmanpreet-Microsoft wants to merge 5 commits into
Conversation
- 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'
ebe3982 to
a452478
Compare
…ence and clear storage if deleted
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the team selection/upload experience by persisting a user’s team choice across sessions and by passing the uploaded team object back to the page-level handler so it can immediately become the selected/default team.
Changes:
- Update
TeamSelectorsoonTeamUploadcan receive (and is invoked with) the uploadedTeamConfig. - Enhance
HomePageinitialization to restore a previously stored team and persist newly selected/uploaded teams to storage. - Update
HomePage’s upload handler to accept the uploaded team object, set it as selected, persist it, and attempt backend selection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/App/src/pages/HomePage.tsx | Restores/persists selected team state and updates upload handling to accept the uploaded team object. |
| src/App/src/components/common/TeamSelector.tsx | Extends onTeamUpload callback to optionally pass the uploaded team to consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+52
to
+55
| // Stored team was deleted, clear localStorage | ||
| console.warn(`Stored team ${storedTeam.team_id} no longer exists, clearing storage`); | ||
| // Don't call storageTeam with null, just let init response guide us | ||
| } |
| ); | ||
|
|
||
| const handleTeamUpload = useCallback(async () => { | ||
| const handleTeamUpload = useCallback(async (uploadedTeam?: any) => { |
| console.error('Team upload failed'); | ||
| } catch (error) { | ||
| console.error('Team upload failed:', error); | ||
| showToast('Team upload completed', 'success'); |
Comment on lines
+44
to
+50
| const existsInBackend = teams.some(t => t.team_id === storedTeam.team_id); | ||
| if (existsInBackend) { | ||
| // Stored team still exists, use it | ||
| dispatch(setSelectedTeam(storedTeam)); | ||
| showToast(`${storedTeam.name} team restored from storage`, 'success'); | ||
| dispatch(setIsLoadingTeam(false)); | ||
| return; |
…prove error handling for team uploads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces improvements to the team selection and upload workflow, focusing on better handling of uploaded teams and restoring team state from previous sessions. The changes enhance user experience by persisting team selections and providing clearer feedback during team uploads.
Enhancements to team selection and upload:
onTeamUploadprop inTeamSelectornow accepts an optionalTeamConfigparameter, allowing the uploaded team to be passed directly to handlers.TeamSelectorcomponent now passes the uploaded team object to theonTeamUploadcallback when a team is uploaded, ensuring the handler receives the correct data. [1] [2]handleTeamUploadfunction inHomePage.tsxis updated to accept the uploaded team, sets it as the selected team, stores it for persistence, and displays a toast notification. Improved error handling and logging are also added.Persistence and restoration of team selection:
HomePagenow checkslocalStoragefor a previously uploaded team and restores it as the selected team, providing a toast notification to inform the user.Minor data update:
content_gen.jsonfile to new values, likely for testing or data consistency.Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information