github refinedev/refine @refinedev/core@4.48.0

Minor Changes

  • #5609 fd38d9c71a6 Thanks @Cavdy! - feat: ability to pass an argument to usePermissions #5607

    Ability to pass an argument or parameters to usePermissions hook

    const params = { tenantId: "id" };
    usePermissions({ params });

    Resolves #5607

  • #5610 17c39ee2ee0 Thanks @Conqxeror! - feat: allow passing function to optionLabel and optionValue props for useSelect hook.

    const { options } = useSelect({
      optionLabel: (item) => `${item.firstName} ${item.lastName}`,
      optionValue: (item) => item.id,
    });

    feat: add searchField prop to useSelect hook.

    Can be used to specify which field will be searched with value given to onSearch function.

    const { onSearch } = useSelect({ searchField: "name" });
    
    onSearch("John"); // Searchs by `name` field with value John.

    By default, it uses optionLabel's value, if optionLabel is a string. Uses title field otherwise.

    // When `optionLabel` is string.
    const { onSearch } = useSelect({ optionLabel: "name" });
    
    onSearch("John"); // Searchs by `name` field with value John.
    
    // When `optionLabel` is function.
    const { onSearch } = useSelect({
      optionLabel: (item) => `${item.id} - ${item.name}`,
    });
    
    onSearch("John"); // Searchs by `title` field with value John.

    Resolves #4880

Patch Changes

Don't miss a new refine release

NewReleases is sending notifications on new releases.