Repository navigation
feat(scraps): Publish Link in the shadcn registry - #133339
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
Add a scraps/link registry:ui item that re-exports Link from @sentry/scraps/link, with LinkBehaviorContextProvider and useResolveLinkHref so apps can route it through their own router. Closes DE-1995
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
scraps/linkregistry:uiitem.pnpm dlx shadcn@latest add getsentry/sentry/scraps/linkwritescomponents/ui/scraps/link.tsx, which re-exportsLink,LinkProps,LinkBehaviorContextProvider, anduseResolveLinkHreffrom@sentry/scraps/link. It depends on@sentry/scraps@>=0.8.0and@emotion/react, like the Button item.stock shadcn/ui has no link component, only
buttonVariants({variant: 'link'}). ScrapsLinkadds the themed link colors, focus ring, adisabledstate that drops the href, andtodestinations given as objects ({pathname, query, hash}) that it serializes for you.Linkdoesn't depend on any router. With no provider it renders<a href>. To navigate client-side, an app wraps its tree inLinkBehaviorContextProviderwith a small adapter around its router's link, andreplace,preventScrollReset, andstatereach that adapter unchanged. This works with React Router or Next (Sentry Evals already uses this pattern withnext/link). The README gets a new## shadcn/ui componentssection with the install command and a React Router adapter example. Modifier-clicks are left to the browser, because Scraps never callspreventDefaulton an enabled link.One setup snag is documented in the README.
@sentry/scrapspins@types/react@19.3.0as a regular dependency. When an app resolves a different@types/react, spreadingLinkPropsonto the router's link fails to typecheck onref. Overriding@types/reactto the app's version fixes it. The real fix is moving@types/reactto a peer dependency in a later Scraps release.Closes DE-1995
via @natemoo-re.
--
View Session [Sentry]