Skip to content

Commit d4488d0

Browse files
author
Scott Jackson
committed
Make url optional. Remove krustykrab from dependencies for react-select-fetch
1 parent 5ab057d commit d4488d0

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/react-select-fetch/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"react-select-async-paginate": "^0.7.0"
4444
},
4545
"dependencies": {
46-
"krustykrab": "^1.1.0",
4746
"qs": "^6.14.0"
4847
},
4948
"devDependencies": {

packages/react-select-fetch/src/get.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { stringifyParams } from "./stringifyParams";
22

33
export const get = async (
4-
url: string,
4+
url: string|undefined,
55
params: Record<string, unknown>,
66
): Promise<unknown> => {
7+
if (url == null) {
8+
throw new Error("The `url` prop is required unless `get` is overridden.")
9+
}
710
const paramsStr = stringifyParams(params);
811

912
const response: Response = await fetch(`${url}?${paramsStr}`, {

packages/react-select-fetch/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export type MapResponse<OptionType, Group extends GroupBase<OptionType>> = (
3030
) => Response<OptionType, Group, Additional>;
3131

3232
export type Get = <Response>(
33-
url: string,
33+
url: string|undefined,
3434
params: {
3535
[key: string]: unknown;
3636
},
@@ -40,7 +40,7 @@ export type UseSelectFetchMapParams<
4040
OptionType,
4141
Group extends GroupBase<OptionType>,
4242
> = {
43-
url: string;
43+
url?: string;
4444
queryParams?: {
4545
[key: string]: unknown;
4646
};

packages/react-select-fetch/src/useMapToAsyncPaginate.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { getResult } from "krustykrab";
21
import { useCallback, useMemo } from "react";
32
import type { GroupBase } from "react-select";
43
import { checkIsResponse } from "react-select-async-paginate";

0 commit comments

Comments
 (0)