Skip to content

Comments

Projects page ui lazy loads audit, codebooks and teams#180

Merged
jankapunkt merged 5 commits intomainfrom
fix/projects-full-lazy-loading
Aug 19, 2025
Merged

Projects page ui lazy loads audit, codebooks and teams#180
jankapunkt merged 5 commits intomainfrom
fix/projects-full-lazy-loading

Conversation

@jankapunkt
Copy link
Member

@jankapunkt jankapunkt commented Aug 15, 2025

Implements full lazy loading of project related data.

Progress:

  • load audits on audit page
  • load teams on team page (ui)
  • load teams on team page (server)
  • load codebooks on codebooks page (client)
  • load codebooks on codebooks page (server)

@jankapunkt jankapunkt added this to the 1.1.0 milestone Aug 15, 2025
@jankapunkt jankapunkt linked an issue Aug 15, 2025 that may be closed by this pull request
4 tasks
Alessandro Belli added 2 commits August 18, 2025 11:11
- Installed laravel debugbar to better understand number of queries executed, use only on dev.
- Optimized Audit Loading: Audits are no longer pre-loaded on the project list and project overview pages. Instead, they are now fetched on-demand, which dramatically reduces the number of initial database queries and improves page load times.
- Accurate Filter Counts: The audit filter counts now accurately reflect the total number of audits for each filter type, rather than just the count for the current page. This is achieved by calculating the counts on the backend.

These changes result in a faster, more efficient, and more user-friendly experience when working with projects and audits.
Team data is no longer pre-loaded on the project overview page. Instead, it is now fetched from a dedicated API endpoint when the "Collaboration" tab is clicked. This reduces the number of initial database queries and improves page load times.
In addition to that, I removed the "ownTeams" from HandleInertiaRequests.php so we don't load that in every page, but only when it's needed.
@alessandrobelli
Copy link
Contributor

Codebooks were already lazy loaded as for #164 , now I optimized the audits and the teams by also removing some data load that wasn't needed in every page.

@jankapunkt jankapunkt marked this pull request as ready for review August 18, 2025 11:10
@jankapunkt jankapunkt requested review from Copilot and kadewe August 18, 2025 11:10
@jankapunkt
Copy link
Member Author

@alessandrobelli please install this branch on staging and send the link to @kadewe so @kadewe can test and add their review here. We should not merge before its not approved by @kadewe

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Implements comprehensive lazy loading for project-related data (audits, codebooks, and teams) to improve performance by loading data only when needed instead of upfront.

  • Removes server-side data preloading for audits, teams, and owned teams from initial page renders
  • Introduces client-side composables (useAudit, useTeam) to manage lazy-loaded data
  • Adds new API endpoints for fetching team data and user-owned teams on demand

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
web/routes/web.php Adds new API routes for project team data and user owned teams
web/resources/js/domain/teams/useTeam.js Implements team data lazy loading with reactive state management
web/resources/js/domain/project/Project.js Adds project update method for client-side operations
web/resources/js/domain/audit/useAudit.js New composable for managing audit data with lazy loading
web/resources/js/Pages/Teams/ProjectTeams.vue Updates to use lazy-loaded team data instead of props
web/resources/js/Components/global/Audit.vue Refactors to use audit composable and removes prop dependencies
web/app/Http/Controllers/ProjectController.php Removes audit preloading and adds team data endpoint
web/app/Http/Controllers/UserController.php New controller for serving user-owned teams data
web/app/Services/AuditService.php Adds audit count aggregation functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jankapunkt jankapunkt added bug Something isn't working live (staging) This is live and ready to be field-tested on our staging system labels Aug 19, 2025
Copy link
Contributor

@kadewe kadewe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me – this will be a performance boost without introducing any security concerns.

@jankapunkt jankapunkt merged commit a7a63ba into main Aug 19, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working live (staging) This is live and ready to be field-tested on our staging system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Project load performance

3 participants