Skip to content

Commit

Permalink
fix: ensure types for fetchers always include form* submission fields (
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Feb 15, 2023
1 parent 2f1e3f4 commit db97131
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-singers-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": patch
---

Ensure types for fetchers always include form\* submission fields
8 changes: 8 additions & 0 deletions packages/remix-react/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,10 @@ function convertRouterFetcherToRemixFetcher(
let fetcher: FetcherStates["Done"] = {
state: "idle",
type: "done",
formMethod: undefined,
formAction: undefined,
formData: undefined,
formEncType: undefined,
submission: undefined,
data,
};
Expand Down Expand Up @@ -1533,6 +1537,10 @@ function convertRouterFetcherToRemixFetcher(
let fetcher: FetcherStates["Loading"] = {
state: "loading",
type: "normalLoad",
formMethod: undefined,
formAction: undefined,
formData: undefined,
formEncType: undefined,
submission: undefined,
data,
};
Expand Down
16 changes: 16 additions & 0 deletions packages/remix-react/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export type FetcherStates<TData = any> = {
Idle: {
state: "idle";
type: "init";
formMethod: undefined;
formAction: undefined;
formData: undefined;
formEncType: undefined;
submission: undefined;
data: undefined;
};
Expand Down Expand Up @@ -155,12 +159,20 @@ export type FetcherStates<TData = any> = {
Loading: {
state: "loading";
type: "normalLoad";
formMethod: undefined;
formAction: undefined;
formData: undefined;
formEncType: undefined;
submission: undefined;
data: TData | undefined;
};
Done: {
state: "idle";
type: "done";
formMethod: undefined;
formAction: undefined;
formData: undefined;
formEncType: undefined;
submission: undefined;
data: TData;
};
Expand Down Expand Up @@ -204,5 +216,9 @@ export const IDLE_FETCHER: FetcherStates["Idle"] = {
state: "idle",
type: "init",
data: undefined,
formMethod: undefined,
formAction: undefined,
formData: undefined,
formEncType: undefined,
submission: undefined,
};

0 comments on commit db97131

Please sign in to comment.