Skip to content

perf: use $fetch.raw instead fetch with separate controller + timeout#485

Merged
danielroe merged 6 commits intonpmx-dev:mainfrom
OrbisK:perf/ofetch-timeout
Jan 31, 2026
Merged

perf: use $fetch.raw instead fetch with separate controller + timeout#485
danielroe merged 6 commits intonpmx-dev:mainfrom
OrbisK:perf/ofetch-timeout

Conversation

@OrbisK
Copy link
Copy Markdown
Contributor

@OrbisK OrbisK commented Jan 31, 2026

I know these are micro-optimisations. Initially I was looking to see if every timeout was cleaned up properly.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 31, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jan 31, 2026 5:07pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jan 31, 2026 5:07pm
npmx-lunaria Ignored Ignored Jan 31, 2026 5:07pm

Request Review

headers: {
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'npmx.dev',
'User-Agent': 'npmx',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

every other user-agent is npmx not npmx.dev

Copy link
Copy Markdown
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

❤️

@danielroe danielroe enabled auto-merge January 31, 2026 12:25
@OrbisK
Copy link
Copy Markdown
Contributor Author

OrbisK commented Jan 31, 2026

Tests are failing. I will take a look

auto-merge was automatically disabled January 31, 2026 16:04

Head branch was pushed to by a user without write access

@OrbisK
Copy link
Copy Markdown
Contributor Author

OrbisK commented Jan 31, 2026

@danielroe Okay. I was super confused becaused it worked locally. But it was cached all the time. 😅

I think this might be a ofetch bug (or at least a type issue). The problem is here

https://github.com/OrbisK/npmx.dev/blob/397c8a521c9ec4d91ea179cad5845d1ac8c80fb6/server/utils/docs/client.ts#L102

response.text() throws because the body is already read. I wonder if .raw should not expose .text() and .json()

@danielroe danielroe added this pull request to the merge queue Jan 31, 2026
Merged via the queue into npmx-dev:main with commit f8f4373 Jan 31, 2026
13 checks passed
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