Skip to content

🔄 Sync: [TanStack Query Optimization]#213

Open
ldsgroups225 wants to merge 1 commit intomasterfrom
sync/tanstack-query-optimization-5424144849801883906
Open

🔄 Sync: [TanStack Query Optimization]#213
ldsgroups225 wants to merge 1 commit intomasterfrom
sync/tanstack-query-optimization-5424144849801883906

Conversation

@ldsgroups225
Copy link
Copy Markdown
Owner

@ldsgroups225 ldsgroups225 commented Mar 29, 2026

Implement useIsMutationPending for global mutation tracking (loading bars/states). Ensure proper cache management and UI feedback.


PR created automatically by Jules for task 5424144849801883906 started by @ldsgroups225

Summary by CodeRabbit

  • Refactor
    • Improved internal state management for saving operations.

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

📝 Walkthrough

Walkthrough

The use-class-detail-grade-entry hook refactors its isSaving state computation to derive pending status from two mutation keys using a centralized useIsMutationPending helper, replacing direct mutation instance reads while preserving all mutation execution flows.

Changes

Cohort / File(s) Summary
Mutation Pending State Derivation
apps/teacher/src/hooks/use-class-detail-grade-entry.ts
Refactors isSaving computation to use useIsMutationPending helper for tracking pending status of local notes save and grades publish mutations instead of directly reading mutation instance isPending properties.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hopping through mutations with glee,
The pending states now flow as one decree,
A helper so neat, a rabbit's delight,
Where isSaving bounces just right!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title uses an emoji and vague bracketed text that don't clearly convey the main change of refactoring mutation pending state tracking with useIsMutationPending. Replace the emoji and generic phrasing with a specific title like 'Refactor mutation pending state tracking with useIsMutationPending helper' for clarity.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/tanstack-query-optimization-5424144849801883906

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/teacher/src/hooks/use-class-detail-grade-entry.ts (1)

42-45: This is an intentional semantic change to enable global loading states—no action required, but ensure it aligns with component expectations.

The hook now uses global mutation key tracking via useIsMutationPending(), meaning isSaving reflects the status of any pending mutation with those keys across the app. This is per design (PR mentions "global mutation tracking for loading bars/states") and works correctly in the current architecture since:

  • Only one ClassDetailPage instance exists at a time (route-based)
  • All consumers (UnpublishedNoteSheet, ClassDetailStudentsSection, ClassDetailHeader) are immediate children of ClassDetailPage working as a cohesive unit
  • The mutations they trigger are contextual to the current class detail view

No functional issue here—just a heads-up that this is now global rather than scoped to a single hook instance.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/teacher/src/hooks/use-class-detail-grade-entry.ts` around lines 42 - 45,
The change makes isSaving computed from useIsMutationPending with
teacherMutationKeys.localNotes.save and teacherMutationKeys.grades.publish so it
now represents any global pending mutation for those keys; no code changes
required, but verify that consumers (UnpublishedNoteSheet,
ClassDetailStudentsSection, ClassDetailHeader) of the hook within
ClassDetailPage expect a global loading state and that only one ClassDetailPage
is mounted at a time—if any component requires instance-scoped pending state
instead, replace useIsMutationPending usage in use-class-detail-grade-entry.ts
with a scoped mutation tracker or pass-through local mutation states from the
specific mutation hooks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/teacher/src/hooks/use-class-detail-grade-entry.ts`:
- Around line 42-45: The change makes isSaving computed from
useIsMutationPending with teacherMutationKeys.localNotes.save and
teacherMutationKeys.grades.publish so it now represents any global pending
mutation for those keys; no code changes required, but verify that consumers
(UnpublishedNoteSheet, ClassDetailStudentsSection, ClassDetailHeader) of the
hook within ClassDetailPage expect a global loading state and that only one
ClassDetailPage is mounted at a time—if any component requires instance-scoped
pending state instead, replace useIsMutationPending usage in
use-class-detail-grade-entry.ts with a scoped mutation tracker or pass-through
local mutation states from the specific mutation hooks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f6b8691-ea48-40d9-9713-3e139582e403

📥 Commits

Reviewing files that changed from the base of the PR and between a2e0816 and e24e4da.

📒 Files selected for processing (1)
  • apps/teacher/src/hooks/use-class-detail-grade-entry.ts

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.

1 participant