Skip to content

Conversation

@ShubhamPatra
Copy link

Summary

This PR improves code quality by cleaning up debug logging and enhancing TypeScript type safety in the codebase.

Changes

  • Remove debug console logs from compileMDX.ts that were logging cache hits/misses during build time
  • Improve TypeScript types in usePendingRoute.ts by replacing any with ReturnType | undefined

Motivation

  1. Cleaner Build Output: The console logs in compileMDX.ts were debug statements that cluttered the build process without providing value to end users
  2. Better Type Safety: Replacing any with explicit types improves code maintainability and catches potential errors at compile time, aligning with the project's strict TypeScript configuration

Testing

  • TypeScript compilation passes with strict mode
  • No runtime errors introduced
  • Existing functionality unchanged

Files Changed

  • src/utils/compileMDX.ts - Removed 2 console.log statements
  • src/hooks/usePendingRoute.ts - Improved timer type definition

Checklist

  • Code follows the project's style guidelines
  • Changes are minimal and focused
  • No breaking changes introduced
  • TypeScript types are properly defined

- Remove build-time console.log statements from compileMDX.ts
- Replace 'any' type with proper ReturnType<typeof setTimeout> in usePendingRoute.ts
- Improves code quality and type safety
@github-actions
Copy link

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.9 KB (🟡 +1 B) 238.44 KB
/500 127.91 KB (🟡 +1 B) 238.45 KB
/[[...markdownPath]] 130.35 KB (🟡 +1 B) 240.89 KB
/errors 128.15 KB (🟡 +1 B) 238.69 KB
/errors/[errorCode] 128.13 KB (🟡 +1 B) 238.67 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant