pastelsky / bundlephobia

🏋️ Find out the cost of adding a new frontend dependency to your project
https://bundlephobia.com
MIT License
8.92k stars 221 forks source link

Limit bars in graph #736

Closed qw-in closed 1 year ago

qw-in commented 1 year ago

Fix #734

For packages with a long history (such as react-router) the bar graph was overflowing over the bundle stats.

Screenshot 2022-12-24 at 1 36 47 PM

My quick fix for this was simply to limit the total historical items shown for all screen sizes. Probably not the perfect long term solution but should sort things out for now. If there is interest I could take a crack at making it scrollable instead in a future pr.

Perhaps related to #714


If you would like to test locally, here is how I patched in a long history:

Copy the results of this url:

https://bundlephobia.com/api/package-history?package=react-router@6.6.1

Return them here something like the following

// client/api.ts
  static getHistory(packageString: string) {
    if (packageString.startsWith('react-router')) {
      return Promise.resolve(
        /* JSON result from above url here */
      )
    }
  }
qw-in commented 1 year ago

Closing in favour of https://github.com/pastelsky/bundlephobia/issues/734#issuecomment-1372046543