dub icon indicating copy to clipboard operation
dub copied to clipboard

[FEAT]: use RSCs in @dub/ui Fixes

Open versecafe opened this issue 1 year ago • 11 comments

Fixes https://github.com/dubinc/dub/issues/567

Goal

Reduce client side load and improve initial input delay times by taking advantage of RSCs in Next rather than having tsup apply a "use client"; banner over the entire package. Relies on

/** @type {import('next').NextConfig} */
module.exports = {
  transpilePackages: ["@dub/ui"],
  ...
}

This can be continually improved by more carefully crafting components to minimize client code inside in things such as the Nav & Suspense boundaries setup in preparation for ppr becoming stable.

versecafe avatar Jan 19 '24 16:01 versecafe

@versecafe is attempting to deploy a commit to the Elegance Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 19 '24 16:01 vercel[bot]

@steven-tey This should be good to go, everything compiles and works in local testing without issue and all components that are portable to RSCs without a major refactor have been moved.

versecafe avatar Jan 20 '24 03:01 versecafe

@subh-cs When you have some time could you review this and what's your opinion on bumping the package version to 0.1.0 as the transpile step is a breaking change for any external user not that I think there are any but just in case

versecafe avatar Jan 29 '24 17:01 versecafe

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 30, 2024 6:36am

vercel[bot] avatar Jan 30 '24 05:01 vercel[bot]

This looks great, thank you! Curious to know what the approximate improvement in initial input delay time would be with this change – were you able to run any benchmarks for this?

steven-tey avatar Jan 30 '24 06:01 steven-tey

@steven-tey Not sure on the exact reduction testing FID has been a bit annoying, but when using artificial throttling for "low end mobile" on chrome dev tools there was a decent improvement in page load and responsiveness, This should be stable to merge but also could use improvements on splitting bigger portions like the Nav & Footer into client and server components before hand if that would be preferred.

versecafe avatar Feb 04 '24 21:02 versecafe

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@next-auth/[email protected] Transitive: environment, filesystem, shell +2 19.8 MB balazsorban
npm/@planetscale/[email protected] network 0 49.4 kB ayrton
npm/@splinetool/[email protected] network +2 6.16 MB alelepd
npm/@stripe/[email protected] None 0 428 kB madhav-stripe
npm/@tailwindcss/[email protected] Transitive: environment, filesystem, network, shell, unsafe +107 14.9 MB thecrypticace
npm/@tailwindcss/[email protected] Transitive: environment, filesystem, network, shell, unsafe +110 15.2 MB thecrypticace
npm/@types/[email protected] None 0 6.75 kB types
npm/@types/[email protected] None 0 2.77 kB types
npm/@types/[email protected] None 0 3.2 kB types
npm/@types/[email protected] None 0 34 kB types
npm/@types/[email protected] None 0 5.53 kB types
npm/@types/[email protected] None +3 1.69 MB types
npm/@types/[email protected] None +2 19.4 kB types
npm/@upstash/[email protected] Transitive: environment, network +3 1.04 MB mdogan
npm/@upstash/[email protected] environment, network +1 762 kB hezarfen
npm/@vercel/[email protected] Transitive: environment, filesystem, network, shell, unsafe +2 85.5 MB vercel-release-bot
npm/@vercel/[email protected] None 0 27.2 kB vercel-release-bot
npm/@vercel/[email protected] Transitive: environment, filesystem, network, shell, unsafe +1 85.5 MB vercel-release-bot
npm/@visx/[email protected] Transitive: environment +27 4.14 MB christopher.card.williams
npm/@visx/[email protected] None +1 22.8 kB christopher.card.williams
npm/@visx/[email protected] Transitive: environment +9 759 kB christopher.card.williams
npm/@visx/[email protected] Transitive: environment +26 4.24 MB christopher.card.williams
npm/@visx/[email protected] Transitive: environment +5 2.55 MB christopher.card.williams
npm/@visx/[email protected] None +22 2.09 MB christopher.card.williams
npm/@visx/[email protected] Transitive: environment +23 4.02 MB christopher.card.williams
npm/@visx/[email protected] Transitive: environment +7 372 kB christopher.card.williams
npm/[email protected] environment Transitive: filesystem, shell +6 416 kB ai
npm/[email protected] environment, filesystem, network Transitive: eval +4 5.32 MB cloudinary
npm/[email protected] None +18 668 kB paco
npm/[email protected] environment, filesystem +5 12.8 MB gustavohenke
npm/[email protected] None 0 154 kB crisp-dev
npm/[email protected] environment, filesystem +1 139 kB kerimdzhanov
npm/[email protected] None 0 392 kB krisk
npm/[email protected] None 0 15.9 kB wooorm
npm/[email protected] None 0 124 kB mathias
npm/[email protected] None 0 15.6 kB webreflection
npm/[email protected] None 0 26.2 kB carhartl
npm/[email protected] None 0 21 MB ericfennis
npm/[email protected] None 0 6.72 kB styfle
npm/[email protected] None 0 10.9 kB ai
npm/[email protected] environment, filesystem, network, shell, unsafe +26 1.11 GB vercel-release-bot
npm/[email protected] environment, filesystem, network, shell, unsafe 0 85.3 MB vercel-release-bot
npm/[email protected] None +1 289 kB taoqf
npm/[email protected] None 0 0 B
npm/[email protected] None 0 32.7 kB jsdevel
npm/[email protected] None 0 250 kB pjmolina
npm/[email protected] None 0 260 kB pokoli
npm/[email protected] None 0 335 kB ibalosh
npm/[email protected] environment Transitive: filesystem, unsafe +1 8.41 MB simonhaenisch
npm/[email protected] Transitive: environment, filesystem, unsafe +2 11 MB thecrypticace
npm/[email protected] environment, filesystem, unsafe 0 8.39 MB prettier-bot
npm/[email protected] environment 0 11.2 MB prismabot
npm/[email protected] None 0 391 kB omgovich
npm/[email protected] None 0 6.76 kB daniel-lundin
npm/[email protected] Transitive: environment, filesystem, network, shell, unsafe +40 103 MB gabrielmfern
npm/[email protected] environment +2 1.72 MB sergei-startsev
npm/[email protected] None 0 84.6 kB rpearce
npm/[email protected] None 0 73.4 kB marko424
npm/[email protected] environment 0 9.38 kB tdfka_rick
npm/[email protected] None 0 57.9 kB react-textarea-autosize-release-bot
npm/[email protected] None +2 7.4 MB lfades
npm/[email protected] environment +2 337 kB gnoff
npm/[email protected] None +1 46.6 kB wooorm
npm/[email protected] Transitive: filesystem, network +3 16.8 MB atomiks
npm/[email protected] None +1 26.7 kB wooorm
npm/[email protected] None 0 17 kB wooorm
npm/[email protected] filesystem, network +1 15.9 MB antfu
npm/[email protected] None 0 145 kB emilkowalski
npm/[email protected] network, shell 0 3.57 MB stripe-bindings
npm/[email protected] None 0 620 kB vercel-release-bot
npm/[email protected] None +2 989 kB dcas
npm/[email protected] None 0 4.74 kB reslear
npm/[email protected] None 0 16.9 kB ecklf
npm/[email protected] environment, filesystem Transitive: network, shell, unsafe +105 14.8 MB adamwathan
npm/[email protected] None 0 67.6 kB mbostock
npm/[email protected] environment, eval, filesystem Transitive: network, shell, unsafe +57 239 MB egoist
npm/[email protected] None 0 389 kB hirokiosame
npm/[email protected] None 0 0 B
npm/[email protected] None 0 32.4 MB typescript-bot
npm/[email protected] environment, network 0 330 kB unsplash
npm/[email protected] None 0 106 kB xnimorz
npm/[email protected] None +18 810 kB emilkowalski
npm/[email protected] None +1 695 kB andrewvo89
npm/[email protected] None +1 831 kB samchungy
npm/[email protected] None 0 628 kB colinmcd94

🚮 Removed packages: npm/@boxyhq/[email protected], npm/@dub/[email protected], npm/@next-auth/[email protected], npm/@planetscale/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@radix-ui/[email protected], npm/@splinetool/[email protected], npm/@stripe/[email protected], npm/@tailwindcss/[email protected], npm/@tailwindcss/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@types/[email protected], npm/@upstash/[email protected], npm/@upstash/[email protected], npm/@vercel/[email protected], npm/@vercel/[email protected], npm/@vercel/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/@visx/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

socket-security[bot] avatar Mar 08 '24 02:03 socket-security[bot]

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
Telemetry npm/[email protected]
  • Note: Can be disabled by setting the environment variable NEXT_TELEMETRY_DISABLED=1 . See https://nextjs.org/telemetry for more information
Install scripts npm/[email protected]
  • Install script: preinstall
  • Source: node scripts/preinstall-entry.js
Telemetry npm/[email protected]
  • Note: Can be disabled by setting the environment variable NEXT_TELEMETRY_DISABLED=1 . See https://nextjs.org/telemetry for more information

View full report↗︎

Next steps

What is telemetry?

This package contains telemetry which tracks how it is used.

Most telemetry comes with settings to disable it. Consider disabling telemetry if you do not want to be tracked.

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

socket-security[bot] avatar Mar 08 '24 02:03 socket-security[bot]

Reactions to setting off a giant socket security report without ever adding a new package

  1. break lock file during tiny merge conflict
  2. "this is fine just run pnpm i
  3. "oh no oh no this just flagged dozens of package changes"
  4. realize it's just minor version bumps allowed by the package json specifications

versecafe avatar Mar 08 '24 02:03 versecafe

@steven-tey would this be good to merge as all components are now client or server and properly being bundled as RSCs and client components or do you want me to go break down some of the larger portions like Nav and Footer into client server splits since they are larger components that load on most every page?

versecafe avatar Mar 08 '24 02:03 versecafe

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 12 '24 19:03 CLAassistant