Skip to content

Comments

fix(ui): reduce cls to 0 on package page#1304

Merged
danielroe merged 2 commits intomainfrom
fix/cls
Feb 10, 2026
Merged

fix(ui): reduce cls to 0 on package page#1304
danielroe merged 2 commits intomainfrom
fix/cls

Conversation

@danielroe
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Feb 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 10, 2026 0:52am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Feb 10, 2026 0:52am
npmx-lunaria Ignored Ignored Feb 10, 2026 0:52am

Request Review

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 27.77778% with 26 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/pages/package/[[org]]/[name].vue 18.75% 23 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

This PR introduces performance testing capabilities to the application by adding conditional Lighthouse audit support based on the LH_PERF environment variable. The Lighthouse configuration and shell scripts are updated to switch between performance and accessibility audits, whilst corresponding npm test scripts are added. New documentation is provided in CONTRIBUTING.md detailing the performance testing workflow. Additionally, several Vue components are refactored to simplify rendering logic and improve layout handling, including removal of ClientOnly wrappers and consolidation of conditional rendering patterns.

Possibly related PRs

Suggested labels

front

Suggested reviewers

  • alexdln
🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request has no description provided by the author, making it impossible to assess whether the content relates to the changeset. Add a meaningful pull request description that explains the changes, their purpose, and how they address the CLS reduction objective mentioned in the PR title.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/cls

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

Copy link
Contributor

@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.

Actionable comments posted: 2

lazy: true,
},
)
const { data: contributors, status: contributorsStatus } = useLazyFetch('/api/contributors')
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n app/pages/about.vue | head -50

Repository: npmx-dev/npmx.dev

Length of output: 2162


🏁 Script executed:

rg "useLazyFetch" --type vue -A 3 -B 3

Repository: npmx-dev/npmx.dev

Length of output: 88


🏁 Script executed:

rg "GitHubContributor\|Contributor.*type\|interface.*Contributor" --type ts --type tsx --type vue -A 3

Repository: npmx-dev/npmx.dev

Length of output: 88


🌐 Web query:

Nuxt 3 useLazyFetch TypeScript generic type support

💡 Result:

useLazyFetch does support TypeScript generics—it has the same generic signature as useFetch. In the Nuxt docs the type is shown as: useLazyFetch<DataT, ErrorT>(..., options?: UseFetchOptions<DataT>) -> Promise<AsyncData<DataT, ErrorT>>. [1]

Basic: type the response

type Post = { id: number; title: string }

const { data, error, status } = await useLazyFetch<Post[]>('/api/posts')
// data: Ref<Post[] | null | undefined> (depending on Nuxt version / mode)

(Generics are documented on useFetch, and useLazyFetch is explicitly “same signature”.) [1][2]

Also type the error (optional)

import type { FetchError } from 'ofetch'

type Post = { id: number; title: string }

const { data, error } = await useLazyFetch<Post[], FetchError>('/api/posts')

(Generic ErrorT is part of the documented signature.) [1][2]

If you wrap it, preserve generics/overloads

If you create a custom wrapper composable, type it as typeof useFetch / typeof useLazyFetch (or forward the full generic parameters), otherwise you often lose Nuxt’s built-in typing/inference. [3]

Sources: Nuxt useLazyFetch docs (type signature) [1], Nuxt useFetch docs (generic signature/details) [2], example of preserving types in a custom wrapper [3].


🏁 Script executed:

rg "type.*Contributor|interface.*Contributor" --type ts --type vue

Repository: npmx-dev/npmx.dev

Length of output: 88


🏁 Script executed:

rg "api/contributors" --type ts --type vue -B 2 -A 2

Repository: npmx-dev/npmx.dev

Length of output: 88


🏁 Script executed:

find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.vue" \) | xargs grep -l "contributors" | head -10

Repository: npmx-dev/npmx.dev

Length of output: 149


🏁 Script executed:

cat -n server/api/contributors.get.ts

Repository: npmx-dev/npmx.dev

Length of output: 1798


🏁 Script executed:

rg "type|interface" server/api/contributors.get.ts -A 5

Repository: npmx-dev/npmx.dev

Length of output: 190


🏁 Script executed:

find . -path ./node_modules -prune -o -type f \( -name "*.ts" -o -name "*.d.ts" \) -print | xargs grep -l "contributor" -i | grep -v node_modules | head -15

Repository: npmx-dev/npmx.dev

Length of output: 127


Add type-safe generic to useLazyFetch call.

The call to useLazyFetch lacks a generic type parameter, leaving contributors implicitly typed, which violates the strict type-safety guideline. Import and use the existing GitHubContributor type from the API endpoint.

♻️ Suggested fix
+import type { GitHubContributor } from '~/server/api/contributors.get'
+
 const { data: contributors, status: contributorsStatus } =
-  useLazyFetch('/api/contributors')
+  useLazyFetch<GitHubContributor[]>('/api/contributors')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { data: contributors, status: contributorsStatus } = useLazyFetch('/api/contributors')
import type { GitHubContributor } from '~/server/api/contributors.get'
const { data: contributors, status: contributorsStatus } =
useLazyFetch<GitHubContributor[]>('/api/contributors')

Comment on lines +1240 to +1242
<template #fallback>
<!-- Show skeleton loaders when SSR or access controls are loading -->
</template>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Empty fallback template with misleading comment.

The comment states "Show skeleton loaders when SSR or access controls are loading" but no actual content is rendered. If skeletons are intended for CLS reduction, this appears incomplete. If showing nothing is intentional, consider updating the comment to reflect that.

💡 Suggested fix if skeletons are not needed
             <template `#fallback`>
-              <!-- Show skeleton loaders when SSR or access controls are loading -->
+              <!-- Intentionally empty: component handles its own loading state -->
             </template>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<template #fallback>
<!-- Show skeleton loaders when SSR or access controls are loading -->
</template>
<template `#fallback`>
<!-- Intentionally empty: component handles its own loading state -->
</template>

@danielroe danielroe merged commit f8ab6cb into main Feb 10, 2026
20 checks passed
@danielroe danielroe deleted the fix/cls branch February 10, 2026 00:55
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