Skip to content

[tasks] fix task pagination race in project view#39

Open
dudina-ma wants to merge 3 commits into
masterfrom
fix/project-tasks-pagination-race
Open

[tasks] fix task pagination race in project view#39
dudina-ma wants to merge 3 commits into
masterfrom
fix/project-tasks-pagination-race

Conversation

@dudina-ma

@dudina-ma dudina-ma commented Jul 8, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Bug Fixes
    • Prevented overlapping async loads (projects, tasks, and dashboards, plus admin pages) from overwriting newer results.
    • Improved the project tasks page loading UX: full-page “Loading…” only on the initial project load, with lighter inline indicators on subsequent refreshes.
    • Fixed assignee user search so only the most recent query updates the dropdown and selection no longer allows stale updates.
    • Refined task filter debounced search notifications to avoid redundant or incorrect updates.
    • Updated pagination behavior to rely on the existing reactive fetch, improving consistency across task/project views.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4bd2977-b8bc-43be-8540-ee076830823e

📥 Commits

Reviewing files that changed from the base of the PR and between 3b912ab and 3ee80b0.

📒 Files selected for processing (1)
  • frontend/src/lib/pages/project-tasks.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/lib/pages/project-tasks.svelte

📝 Walkthrough

Walkthrough

This change adds a shared latest-request guard and applies it to frontend search, dashboard, administration, project, and task loading flows. Project-task loading distinguishes initial and subsequent loading states, while pagination relies on reactive offset changes.

Changes

Latest-request loading and search flows

Layer / File(s) Summary
Latest-request guard utility
frontend/src/lib/latest-request.ts
Adds token-based request tracking and runLatest() callbacks that suppress stale success, error, and completion handlers.
Search request handling
frontend/src/lib/components/AssigneeCombobox.svelte, frontend/src/lib/components/TaskFilters.svelte
Guards overlapping assignee searches, invalidates pending searches on selection changes, and conditionally emits debounced filter changes.
Dashboard and administration loading
frontend/src/lib/pages/admin-projects.svelte, frontend/src/lib/pages/admin-users.svelte, frontend/src/lib/pages/dashboard-personal.svelte, frontend/src/lib/pages/dashboard-tasks.svelte
Routes project, user, task, and dashboard loads through latest-request callbacks while updating data, errors, and loading state.
Project and task page loading
frontend/src/lib/pages/projects.svelte, frontend/src/lib/pages/project-tasks.svelte
Replaces manual request versioning or promise handlers with guarded loading, adds subsequent-load messaging for project tasks, and lets pagination rely on reactive offset changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing a task pagination race in the project view.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 backend_Darwin_arm64.tar.gz
🍎 Darwin x86_64 backend_Darwin_x86_64.tar.gz
🐧 Linux arm64 backend_Linux_arm64.tar.gz
🐧 Linux i386 backend_Linux_i386.tar.gz
🐧 Linux x86_64 backend_Linux_x86_64.tar.gz
🪟 Windows arm64 backend_Windows_arm64.zip
🪟 Windows i386 backend_Windows_i386.zip
🪟 Windows x86_64 backend_Windows_x86_64.zip

@capcom6

capcom6 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Это в целом очень популярный шаблон. Нет ли возможности его абстрагировать или может есть готовое решение?
Чтобы сделать один раз и использовать во всех запросах, где возможен эффект гонок.

@dudina-ma dudina-ma force-pushed the fix/project-tasks-pagination-race branch from 9eedd0e to 752c1da Compare July 9, 2026 07:46
@capcom6

capcom6 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Что изменилось?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/lib/components/AssigneeCombobox.svelte (1)

60-76: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Add loading = false to select and clear.

When a search is in-flight and the user selects an item or clears, requestGuard.invalidate() prevents the pending request's onFinally from firing, leaving loading stuck at true. The empty-query branch in doSearch (line 35) already handles this — select and clear should too.

🐛 Proposed fix
 function select(user: UserBrief) {
   requestGuard.invalidate();
   value = user.id;
   selectedName = user.name;
   query = "";
   results = [];
   open = false;
+  loading = false;
 }

 function clear() {
   requestGuard.invalidate();
   value = null;
   selectedName = "";
   query = "";
   results = [];
   open = false;
+  loading = false;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/lib/components/AssigneeCombobox.svelte` around lines 60 - 76,
Set loading = false in both select and clear immediately after
requestGuard.invalidate(), so cancelling an in-flight search cannot leave the
component stuck in a loading state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/lib/pages/project-tasks.svelte`:
- Around line 98-99: Reset the project state whenever the route slug changes so
stale project data is not rendered during a new project load. Update the
slug-change handling in project-tasks.svelte to clear project (and any
associated error state as appropriate) before fetching the new project,
preserving initialLoading’s existing pagination behavior.

---

Outside diff comments:
In `@frontend/src/lib/components/AssigneeCombobox.svelte`:
- Around line 60-76: Set loading = false in both select and clear immediately
after requestGuard.invalidate(), so cancelling an in-flight search cannot leave
the component stuck in a loading state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be6e4369-c6f0-4b5f-9989-adaff9c25aa7

📥 Commits

Reviewing files that changed from the base of the PR and between 752c1da and 3b912ab.

📒 Files selected for processing (9)
  • frontend/src/lib/components/AssigneeCombobox.svelte
  • frontend/src/lib/components/TaskFilters.svelte
  • frontend/src/lib/latest-request.ts
  • frontend/src/lib/pages/admin-projects.svelte
  • frontend/src/lib/pages/admin-users.svelte
  • frontend/src/lib/pages/dashboard-personal.svelte
  • frontend/src/lib/pages/dashboard-tasks.svelte
  • frontend/src/lib/pages/project-tasks.svelte
  • frontend/src/lib/pages/projects.svelte

Comment thread frontend/src/lib/pages/project-tasks.svelte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants