Skip to content

Commit

Permalink
#147 migrate defaultProps to default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
vtaits committed Jun 23, 2023
1 parent 642124d commit 5049628
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
4 changes: 4 additions & 0 deletions packages/react-select-async-paginate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Fixed types import in modern environments [#150](https://github.com/vtaits/react-select-async-paginate/issues/150)

## Improvement

- Migrate `defaultProps` to default arguments [#147](https://github.com/vtaits/react-select-async-paginate/issues/147)

## 0.7.2 (14 dec 2022)

# Bugfix
Expand Down
15 changes: 6 additions & 9 deletions packages/react-select-async-paginate/src/withAsyncPaginate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import type {
WithAsyncPaginateType,
} from './types';

const defaultCacheUniqs: unknown[] = [];
const defaultComponents = {};

type SelectComponentType = <
Option = unknown,
IsMulti extends boolean = boolean,
Expand All @@ -40,10 +43,10 @@ export function withAsyncPaginate(
IsMulti extends boolean = false,
>(props: AsyncPaginateProps<OptionType, Group, Additional, IsMulti>): ReactElement {
const {
components,
selectRef,
components = defaultComponents,
selectRef = undefined,
isLoading: isLoadingProp,
cacheUniqs,
cacheUniqs = defaultCacheUniqs,
...rest
} = props;

Expand All @@ -69,11 +72,5 @@ export function withAsyncPaginate(
);
}

WithAsyncPaginate.defaultProps = {
selectRef: null,
cacheUniqs: [],
components: {},
};

return WithAsyncPaginate;
}
4 changes: 4 additions & 0 deletions packages/react-select-fetch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Fixed types import in modern environments [#150](https://github.com/vtaits/react-select-async-paginate/issues/150)

## Improvement

- Migrate `defaultProps` to default arguments [#147](https://github.com/vtaits/react-select-async-paginate/issues/147)

## 0.5.0 (06 oct 2022)

- Improved typing
Expand Down
15 changes: 6 additions & 9 deletions packages/react-select-fetch/src/withSelectFetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import type {
SelectFetchType,
} from './types';

const defaultCacheUniqs: unknown[] = [];
const defaultComponents = {};

type SelectComponentType = <
Option = unknown,
IsMulti extends boolean = boolean,
Expand All @@ -43,9 +46,9 @@ export function withSelectFetch(
IsMulti extends boolean = false,
>(props: SelectFetchProps<OptionType, Group, IsMulti>): ReactElement {
const {
components,
selectRef,
cacheUniqs,
components = defaultComponents,
selectRef = undefined,
cacheUniqs = defaultCacheUniqs,
...rest
} = props;

Expand All @@ -66,11 +69,5 @@ export function withSelectFetch(
);
}

WithSelectFetch.defaultProps = {
selectRef: null,
cacheUniqs: [],
components: {},
};

return WithSelectFetch;
}

0 comments on commit 5049628

Please sign in to comment.