Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No EmptyIdenticator shown when clicking the multi-selector and all options selected. #34

Closed
GeorgThomassen opened this issue Feb 11, 2024 · 1 comment

Comments

@GeorgThomassen
Copy link

When you pick all the options the EmptyIdenticator is shown:

EmptyIdenticator shown

However, when clicking the component again the EmptyIdenticator is not shown:

EmptyIdenticator not shown

It seems like the CommandEmpty is not kicking in

@hsuanyi-chou
Copy link
Owner

hsuanyi-chou commented Feb 17, 2024

This is related to ComandEmpty of shadcn/ui.

I found a solution in cmdk issue #149

open Command.tsx and replace the CommandEmpty to following snippet

const CommandEmpty = React.forwardRef<
  HTMLDivElement,
  React.ComponentProps<typeof CommandPrimitive.Empty>
>(({ className, ...props }, forwardedRef) => {
  const render = useCommandState((state) => state.filtered.count === 0);

  if (!render) return null;

  return (
    <div
      ref={forwardedRef}
      className={cn('py-6 text-center text-sm', className)}
      cmdk-empty=""
      role="presentation"
      {...props}
    />
  );
});

hsuanyi-chou added a commit that referenced this issue Feb 17, 2024
v0.2.1 fix: emptyIndicator disappeared (#34)
hsuanyi-chou added a commit that referenced this issue Feb 22, 2024
refactor: copy Empty implementation from cmdk(#34)
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

No branches or pull requests

2 participants