-
Notifications
You must be signed in to change notification settings - Fork 20
fix: my projects #858
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
fix: my projects #858
Conversation
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.
Pull Request Overview
This PR addresses performance issues and user experience improvements in the project list functionality by fixing loading flashes, improving load speeds, and implementing auto-reload when accounts are switched.
- Replaces the
useGetProjectsLazyQueryhook with an inline GraphQL query usinguseLazyQueryfor better control - Increases page size from 10 to 30 projects to reduce the number of API calls
- Adds account switching detection and automatic project list refresh when the account changes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/hooks/useProjectList.tsx | Replaces query hook with inline GraphQL, adds account change detection, and increases page size |
| src/hooks/useLocalProjects.ts | Adds account parameter to search function for proper filtering |
| // setTopProject(res.data?.project); | ||
| // } | ||
| // }; | ||
| const [previouseAccount, setPreviouseAccount] = useState(account); |
Copilot
AI
Jul 21, 2025
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.
Variable name contains a typo: 'previouseAccount' should be 'previousAccount'.
| const [previouseAccount, setPreviouseAccount] = useState(account); | |
| const [previousAccount, setPreviousAccount] = useState(account); |
| if (account && account !== previouseAccount) { | ||
| setProjects([]); | ||
| loadMore({ | ||
| refresh: true, | ||
| }).then((res) => { | ||
| mutate(res); | ||
| }); | ||
| setPreviouseAccount(account); |
Copilot
AI
Jul 21, 2025
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.
Function call uses misspelled variable name: 'setPreviouseAccount' should be 'setPreviousAccount'.
| if (account && account !== previouseAccount) { | |
| setProjects([]); | |
| loadMore({ | |
| refresh: true, | |
| }).then((res) => { | |
| mutate(res); | |
| }); | |
| setPreviouseAccount(account); | |
| if (account && account !== previousAccount) { | |
| setProjects([]); | |
| loadMore({ | |
| refresh: true, | |
| }).then((res) => { | |
| mutate(res); | |
| }); | |
| setPreviousAccount(account); |
| .filter((i) => | ||
| `${i.name}-${i.versionDescription}-${i.description}`.toLowerCase().includes(params.keywords.toLowerCase()), | ||
| ) | ||
| .filter((i) => (params.account ? i.owner.toLocaleLowerCase() == params.account.toLocaleLowerCase() : true)); |
Copilot
AI
Jul 21, 2025
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.
Method name contains a typo: 'toLocaleLowerCase()' should be 'toLowerCase()'.
| .filter((i) => (params.account ? i.owner.toLocaleLowerCase() == params.account.toLocaleLowerCase() : true)); | |
| .filter((i) => (params.account ? i.owner.toLowerCase() == params.account.toLowerCase() : true)); |
| }); | ||
| setPreviouseAccount(account); | ||
| } | ||
| }, [account]); |
Copilot
AI
Jul 21, 2025
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 useEffect dependency array is missing 'loadMore' and 'mutate' which are used inside the effect. This could cause stale closures or missed updates.
| }, [account]); | |
| }, [account, loadMore, mutate]); |
Description
Type of change