-
Notifications
You must be signed in to change notification settings - Fork 6
Team Results page now gets settings from query parameters #2276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Team Results page now gets settings from query parameters #2276
Conversation
| const TeamResults = () => { | ||
| const { state } = useContext(AppContext); | ||
| const loading = selectTeamsLoading(state); | ||
| const [open, setOpen] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tracks whether the "Add Team" dialog is open.
| ); | ||
| }); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On page load this gets settings from query parameters.
| setSelectedTeamId(selectedTeamId); | ||
| }, []); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When any setting changes, this update the URL query parameters.
| const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => { | ||
| const { state, dispatch } = useContext(AppContext); | ||
| const { teams, userProfile, csrf } = state; | ||
| const [open, setOpen] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This state is tracked in TeamResults now.
| const [teamMembers, setTeamMembers] = useState(null); | ||
| const isLoading = useRef(true); | ||
| const [sortValue, setSortValue] = useState(SortOption.SENT_DATE); | ||
| const [dateRange, setDateRange] = useState(DateRange.THREE_MONTHS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file are for the story "Keep context in URL: View Feedback #2268".
| const [dateRange, setDateRange] = useState(DateRange.THREE_MONTHS); | ||
| const [includeAll, setIncludeAll] = useState(false); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On page load this gets all the settings from query parameters.
| setSortValue(sort); | ||
| }, []); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When any setting changes, this updates the URL query parameters.
| toQP(selectedRole) { | ||
| return selectedRole.role; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is the line causing one of the CI tests to fail. Looks like selectedRole is sometimes undefined when making this call. I see we're grabbing it from state, so I suspect we need to defer QSP set-up until we have the needed state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! I wonder how I can implement that delay. It's not obvious to me.
I could use setInterval and just check repeatedly.
Did you have another approach in mind?
vhscom
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited to see our links come alive for deep-linking within the app!
No description provided.