refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.

MIT License

Downloads
1.1M
Stars
25.3K
Committers
269

Bot releases are visible (Hide)

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

  • #5199 2b8d658a17a Thanks @aliemir! - Updated the return type of the useSelect hook to only include properties that actually being returned from the hook. Previously, the return type included all properties of the Select component, which was not correct.

  • #5199 2b8d658a17a Thanks @aliemir! - Now useSelect hook accepts 4th generic type TOption which allows you to change the type of options. By default TOption will be equal to BaseOption type which is { label: any; value: any; }. If you want to change the type of options, you can do it like this:

    In PR #5160 the type convertion of the options are tried to be resolved by string conversion. This is not correct due to the fact that the value property of the option can be of any type. This was breaking the connection between the forms and the select inputs.

    This change is reverted in the @refinedev/core, now changed the types and the logic to reflect the correct values of options with the ability to change it via 4th generic type TOption of useSelect hook.

    Mantine's <Select /> component only allows values to be string. In a case of a value not being string, you'll be able to manipulate the options via mapping the options before using them.

    Here's how to get the proper types for the options and fix the value type issue:

    import { Select } from "@mantine/core";
    import { HttpError } from "@refinedev/core";
    import { useSelect } from "@refinedev/mantine";
    
    type IPost = {
        id: number;
        title: string;
        description: string;
    };
    
    type IOption = { value: IPost["id"]; label: IPost["title"] };
    
    const MyComponent = () => {
        const { selectProps } = useSelect<IPost, HttpError, IPost, IOption>({
            resource: "posts",
        });
    
        // This will result in `selectProps.data` to be of type `IOption[]`.
        // <Select /> will not accept `value` as `number` so you'll have to map the options.
    
        return (
            <Select
                {...selectProps}
                data={selectProps.data.map((option) => ({
                    ...option,
                    value: option.value.toString(),
                }))}
            />
        );
    };
    
  • #5201 760cfbaaa2a Thanks @aliemir! - Updated initial value setting logic in useForm to handle nested objects properly.

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

  • #5201 760cfbaaa2a Thanks @aliemir! - Updated initial value setting logic in useForm to handle nested objects properly.
refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

  • #5199 2b8d658a17a Thanks @aliemir! - Exported BaseOption type as successor of the deprecated Option type. BaseOption is { label: any; value: any; }.

    Usage of the deprecated Option type was correctly assuming that the value property of the option is of type string. This assumption was wrong and now the types are changed to reflect the correct values of options with the ability to change it via 4th generic type TOption of useSelect hook.

  • #5199 2b8d658a17a Thanks @aliemir! - Reverted the faulty assumption on option values of useSelect hook to be of type string. Now changed the types and the logic to reflect the correct values of options with the ability to change it via 4th generic type TOption of useSelect hook. (Reverted PR #5160)

    By default TOption will be equal to BaseOption type which is { label: any; value: any; }. If you want to change the type of options, you can do it like this:

    import { HttpError, useSelect } from "@refinedev/core";
    
    type MyData = {
        id: number;
        title: string;
        description: string;
        category: { id: string };
    };
    
    type Option = { label: MyData["title"]; value: MyData["id"] }; // equals to { label: string; value: number; }
    
    useSelect<MyData, HttpError, MyData, Option>({
        resource: "posts",
    });
    
  • #5194 9df999ca643 Thanks @fitrahfm! - fix: use relative path instead of path alias to import FlatTreeItem

    Using path alias causes imported types being any during build/compilation process which should be TreeMenuItem[]

  • #5201 760cfbaaa2a Thanks @aliemir! - Exported the flattenObjectKeys and propertyPathToArray helpers from @refinedev/core package.

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

  • #5199 2b8d658a17a Thanks @aliemir! - Now useSelect, useRadioGroup and useCheckboxGroup hooks accept 4th generic type TOption which allows you to change the type of options. By default TOption will be equal to BaseOption type which is { label: any; value: any; }. If you want to change the type of options, you can do it like this:

    import { useSelect } from "@refinedev/antd";
    import { HttpError } from "@refinedev/core";
    
    type MyData = {
        id: number;
        title: string;
        description: string;
        category: { id: string };
    };
    
    type Option = { label: MyData["title"]; value: MyData["id"] }; // equals to { label: string; value: number; }
    
    useSelect<MyData, HttpError, MyData, Option>({
        resource: "posts",
    });
    
  • #5199 2b8d658a17a Thanks @aliemir! - Updated return types of useSelect, useRadioGroup and useCheckboxGroup hooks to only include properties that actually being returned from the hook. Previously, the return types included all properties of the respective components, which was not correct.

  • #5201 760cfbaaa2a Thanks @aliemir! - Handle nested server side validation errors properly in useForm

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

  • #5167 be899901d0e Thanks @aliemir! - πŸŽƒ halloween update: devtools panel is temporarily welcoming a group of ghosts πŸ‘», don't worry they are harmless. πŸ‘»
refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - [email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes

refine - @refinedev/[email protected]

Published by refine-bot 12 months ago

Patch Changes