-
-
Notifications
You must be signed in to change notification settings - Fork 393
Add search to project select #909
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
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 refactors project selection to use a new reusable ProjectSelect component with infinite scrolling, replacing static project lists that were previously shared globally via Inertia props.
Key changes:
- Introduced a
ProjectSelectcomponent that fetches projects on-demand via API with infinite scroll support - Removed
projectsarray from global auth context to reduce payload size - Added a new
/projects/jsonAPI endpoint to support paginated project fetching
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/js/types/index.d.ts | Removed projects array from Auth interface |
| resources/js/pages/servers/components/transfer-server.tsx | Replaced inline Select with ProjectSelect component and updated handler signature |
| resources/js/pages/projects/components/project-form.tsx | Simplified useEffect logic for handling defaultOpen prop |
| resources/js/components/project-switch.tsx | Refactored to use ProjectSelect component with controlled state and custom footer |
| resources/js/components/project-select.tsx | New component implementing project selection with infinite scroll and search |
| app/Http/Middleware/HandleInertiaRequests.php | Removed projects array from shared Inertia data |
| app/Http/Controllers/Project/ProjectController.php | Added json endpoint for paginated project fetching |
| app/Actions/Projects/GetProjects.php | New action class to handle project querying with pagination and search |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }); | ||
| }; | ||
|
|
||
| const handleProjectChange = (value: string) => { |
Copilot
AI
Nov 2, 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 handleProjectChange function doesn't match the signature expected by ProjectSelect.onValueChange. According to the ProjectSelect interface (line 14 of project-select.tsx), onValueChange expects (value: string, project: Project) => void, but this handler only accepts value: string. Update the signature to include the project parameter: (value: string, project: Project) => void.
| const handleProjectChange = (value: string) => { | |
| const handleProjectChange = (value: string, project: any) => { |
| ); | ||
|
|
||
| const trigger = ( | ||
| <Button variant="ghost" className="px-1!"> |
Copilot
AI
Nov 2, 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.
Invalid CSS class syntax. The exclamation mark should come after 'px-1', not inside the string. Change 'px-1!' to 'px-1'.
| <Button variant="ghost" className="px-1!"> | |
| <Button variant="ghost" className="px-1"> |
No description provided.