Skip to content

Conversation

@RodrigoRafaelSantos7
Copy link

update deprecated function, and remove workspace import

This commit addresses an issue within the Separator component by refactoring it to:

  • Update a deprecated function call to its current, supported equivalent.
  • Remove an unnecessary import

These changes ensure the Separator component is up-to-date with current best practices and dependencies, improving maintainability and stability.

@vercel
Copy link

vercel bot commented Oct 4, 2025

@RodrigoRafaelSantos7 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@shadcn
Copy link
Collaborator

shadcn commented Oct 5, 2025

These changes ensure the Separator component is up-to-date with current best practices and dependencies, improving maintainability and stability.

Can you elaborate on this please?

@RodrigoRafaelSantos7
Copy link
Author

This pull request refactors the Separator component implementation across multiple registry UI packages to simplify imports and type usage, improving consistency and maintainability. The main changes involve switching from importing all of @radix-ui/react-separator as a namespace to importing only the Root component and updating type references accordingly.

Also, it seems like the method ElementRef is deprecated. (this example is in the label component)

Screenshot 2025-10-06 at 01 39 27

Also, if you are using biome or ultracite, you will run into this error because of the import of the whole workspace. In this case importing the hole workspace is not strictly necessary since we only use the primitive Root.

Screenshot 2025-10-06 at 01 41 53

My proposal is that we change the Components (this is the label), from this:

"use client"

import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "src/lib/utils"

const labelVariants = cva(
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)

const Label = React.forwardRef<
  React.ElementRef<typeof LabelPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
    VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
  <LabelPrimitive.Root
    ref={ref}
    className={cn(labelVariants(), className)}
    {...props}
  />
))
Label.displayName = LabelPrimitive.Root.displayName

export { Label }

to this:

"use client";

import { Root as LabelPrimitive } from "@radix-ui/react-label";
import { cn } from "@repo/ui";
import { cva, type VariantProps } from "class-variance-authority";
import React from "react";

const labelVariants = cva(
  "font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
);

const Label = React.forwardRef<
  React.ComponentRef<typeof LabelPrimitive>,
  React.ComponentPropsWithoutRef<typeof LabelPrimitive> &
    VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
  <LabelPrimitive
    className={cn(labelVariants(), className)}
    ref={ref}
    {...props}
  />
));
Label.displayName = LabelPrimitive.displayName;

export { Label };

This changes will also ensure that people using biome or ultracite will not get flagged with errors

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