Skip to content

Commit 4195d89

Browse files
ismoilovdevmlclaude
andcommitted
fix: Fix Overview page data loading on first visit
- Load projects automatically in Overview if not already loaded - Use projectsToUse variable to handle both existing and newly loaded projects - Add setProjects to Overview component dependencies - Fix issue where Overview shows no data on first visit - Update .gitignore to exclude local development files This ensures Overview page works correctly on initial load without requiring users to visit Projects tab first. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fcc67a0 commit 4195d89

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ yarn-error.log*
2727
# Environment files with secrets
2828
.env
2929
.env*.local
30+
.env.local
3031

3132
# vercel
3233
.vercel
@@ -44,6 +45,7 @@ next-env.d.ts
4445

4546
# Local development files
4647
docker-compose.local.yml
48+
docker-compose.local.yaml
4749
test-security.sh
4850
*.backup
4951
*.bak*

src/components/Overview.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default function Overview() {
1818
projects,
1919
setActivePipelines,
2020
setStats,
21+
setProjects,
2122
setIsLoading,
2223
setError,
2324
autoRefresh,
@@ -42,6 +43,12 @@ export default function Overview() {
4243
// Get API instance from database configuration
4344
const api = await getGitLabAPIAsync();
4445

46+
// Load projects if not already loaded
47+
const projectsToUse = projects.length > 0 ? projects : await api.getProjects(1, 50);
48+
if (projects.length === 0 && !abortSignal?.aborted) {
49+
setProjects(projectsToUse);
50+
}
51+
4552
const [pipelines, pipelineStats] = await Promise.all([
4653
api.getAllActivePipelines(),
4754
api.getPipelineStats(),
@@ -55,7 +62,7 @@ export default function Overview() {
5562

5663
// Load recent pipelines from ALL projects for accurate Top Active Projects
5764
// Increase to get better pipeline count statistics
58-
const recentPromises = projects.map(project =>
65+
const recentPromises = projectsToUse.map(project =>
5966
api.getPipelines(project.id, 1, 10).catch(() => [])
6067
);
6168
const allRecent = await Promise.all(recentPromises);
@@ -85,7 +92,7 @@ export default function Overview() {
8592

8693
// Enrich jobs with project data from store
8794
const enrichedJobs = jobs.map(job => {
88-
const projectData = projects.find(p => p.id === job.pipeline.project_id);
95+
const projectData = projectsToUse.find(p => p.id === job.pipeline.project_id);
8996
if (projectData && !job.project) {
9097
// Add project data to job if missing
9198
return {
@@ -117,6 +124,7 @@ export default function Overview() {
117124
useEffect(() => {
118125
const controller = new AbortController();
119126

127+
// Always try to load data - projects will be fetched if needed
120128
loadData(controller.signal);
121129

122130
if (autoRefresh) {

0 commit comments

Comments
 (0)