Skip to content

fix(modules): stop health fetch spam on /modules#2347

Merged
danielroe merged 3 commits into
nuxt:mainfrom
DarlanPrado:bugfix/health-fetch-spam
Jul 24, 2026
Merged

fix(modules): stop health fetch spam on /modules#2347
danielroe merged 3 commits into
nuxt:mainfrom
DarlanPrado:bugfix/health-fetch-spam

Conversation

@DarlanPrado

Copy link
Copy Markdown
Contributor

🔗 Linked issue

resolves #2346

📚 Description

After #2189, /modules started spamming /api/v1/modules/health (Firefox shows NS_BINDING_ABORTED).

useModuleHealth() lived inside useModules(), and each ModuleItem called useModules() only for selectedSort. Infinite scroll mounted more cards → more useFetch calls with the same key → default dedupe: 'cancel' aborted the previous request.

This PR fixes that by:

  • stopping ModuleItem from calling useModules (pass sortKey as a prop instead)
  • hardening useModuleHealth with dedupe: 'defer' + getCachedData
  • switching list pagination to visibleCount + computed so health updates don’t remount the whole grid

Follow-up refactor (not required for the fix):
A second commit moves the health merge out of useModules and into /modules (same pattern as the homepage). That keeps health opt-in for pages that show the badge (useNavigation / changelog no longer trigger the fetch). The spam on scroll is already fixed without this commit — it’s just a cleaner separation of concerns.

@DarlanPrado
DarlanPrado requested a review from atinux as a code owner July 24, 2026 20:44
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@DarlanPrado is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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 Plus

Run ID: 4555171f-89f4-4023-8afd-a181d91a4ddb

📥 Commits

Reviewing files that changed from the base of the PR and between 025a617 and fc4cca3.

📒 Files selected for processing (1)
  • app/pages/modules/index.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/pages/modules/index.vue

📝 Walkthrough

Walkthrough

The module list now retrieves health data with deferred deduplication and Nuxt payload/static cache fallback. Health values are merged in the modules page rather than the shared modules composable. Pagination uses a visible-count slice and resets when search, category, sort, or order changes. ModuleItem receives the active sort key to select date values and tooltip labels.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: stopping repeated health fetches on /modules.
Description check ✅ Passed The description is directly related to the changes and explains the request-spam fix clearly.
Linked Issues check ✅ Passed The changes address #2346 by preventing repeated /api/v1/modules/health requests during scrolling and remounts.
Out of Scope Changes check ✅ Passed The code changes stay focused on the /modules health-fetch spam fix and its supporting refactor.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@app/pages/modules/index.vue`:
- Around line 87-90: Update the pagination timer in the filter/sort watcher to
store its setTimeout handle and clear any pending timer before resetting filters
or scheduling a new load. Ensure the callback still increments visibleCount and
resets isLoading only when the timer has not been cancelled.
🪄 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 Plus

Run ID: 0796c8d4-072e-4672-9022-78e692a76264

📥 Commits

Reviewing files that changed from the base of the PR and between aba6dbd and 025a617.

📒 Files selected for processing (4)
  • app/components/module/ModuleItem.vue
  • app/composables/useModuleHealth.ts
  • app/composables/useModules.ts
  • app/pages/modules/index.vue

Comment thread app/pages/modules/index.vue Outdated
@DarlanPrado

Copy link
Copy Markdown
Contributor Author

@danielroe @Flo0806 this PR resolves #2346 ?

@danielroe
danielroe merged commit 3f6a2cc into nuxt:main Jul 24, 2026
7 of 8 checks passed
@Flo0806

Flo0806 commented Jul 25, 2026

Copy link
Copy Markdown
Member

Thx and sorry for the mistake ❤️

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.

useModuleHealth composable re-fetches /api/v1/modules/health repeatedly on /modules, causing request spam (NS_BINDING_ABORTED)

3 participants