@tanstack/react-form 0.25.3 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const start = require("@tanstack/start");
4
3
  const utils = require("./utils.cjs");
5
4
  const initialFormState = {
6
5
  errorMap: {
@@ -8,7 +7,7 @@ const initialFormState = {
8
7
  },
9
8
  errors: []
10
9
  };
11
- const getFormData = start.createServerFn("GET", async (_, ctx) => {
10
+ const getFormData = async (ctx) => {
12
11
  const data = await utils._tanstackInternalsCookie.parse(
13
12
  ctx.request.headers.get("Cookie")
14
13
  );
@@ -16,7 +15,7 @@ const getFormData = start.createServerFn("GET", async (_, ctx) => {
16
15
  if (!data)
17
16
  return initialFormState;
18
17
  return data;
19
- });
18
+ };
20
19
  exports.getFormData = getFormData;
21
20
  exports.initialFormState = initialFormState;
22
21
  //# sourceMappingURL=getFormData.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFormData.cjs","sources":["../../../src/start/getFormData.tsx"],"sourcesContent":["import { createServerFn } from '@tanstack/start'\nimport { _tanstackInternalsCookie } from './utils'\nimport type { ServerFormState } from './types'\n\nexport const initialFormState = {\n errorMap: {\n onServer: undefined,\n },\n errors: [],\n}\n\nexport const getFormData = createServerFn('GET', async (_, ctx) => {\n const data = (await _tanstackInternalsCookie.parse(\n ctx.request.headers.get('Cookie'),\n )) as undefined | ServerFormState<any>\n // Delete the cookie before it hits the client again¸\n ctx.request.headers.delete('Cookie')\n if (!data) return initialFormState\n return data\n})\n"],"names":["createServerFn","_tanstackInternalsCookie"],"mappings":";;;;AAIO,MAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ,CAAC;AACX;AAEO,MAAM,cAAcA,MAAAA,eAAe,OAAO,OAAO,GAAG,QAAQ;AAC3D,QAAA,OAAQ,MAAMC,MAAAA,yBAAyB;AAAA,IAC3C,IAAI,QAAQ,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAG9B,MAAA,QAAQ,QAAQ,OAAO,QAAQ;AACnC,MAAI,CAAC;AAAa,WAAA;AACX,SAAA;AACT,CAAC;;;"}
1
+ {"version":3,"file":"getFormData.cjs","sources":["../../../src/start/getFormData.tsx"],"sourcesContent":["import { _tanstackInternalsCookie } from './utils'\nimport type { FetchFnCtx } from '@tanstack/start'\nimport type { ServerFormState } from './types'\n\nexport const initialFormState = {\n errorMap: {\n onServer: undefined,\n },\n errors: [],\n}\n\nexport const getFormData = async (ctx: FetchFnCtx) => {\n const data = (await _tanstackInternalsCookie.parse(\n ctx.request.headers.get('Cookie'),\n )) as undefined | ServerFormState<any>\n // Delete the cookie before it hits the client again¸\n ctx.request.headers.delete('Cookie')\n if (!data) return initialFormState\n return data\n}\n"],"names":["_tanstackInternalsCookie"],"mappings":";;;AAIO,MAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ,CAAC;AACX;AAEa,MAAA,cAAc,OAAO,QAAoB;AAC9C,QAAA,OAAQ,MAAMA,MAAAA,yBAAyB;AAAA,IAC3C,IAAI,QAAQ,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAG9B,MAAA,QAAQ,QAAQ,OAAO,QAAQ;AACnC,MAAI,CAAC;AAAa,WAAA;AACX,SAAA;AACT;;;"}
@@ -1,3 +1,4 @@
1
+ import { FetchFnCtx } from '@tanstack/start';
1
2
  import { ServerFormState } from './types.cjs';
2
3
 
3
4
  export declare const initialFormState: {
@@ -6,7 +7,7 @@ export declare const initialFormState: {
6
7
  };
7
8
  errors: never[];
8
9
  };
9
- export declare const getFormData: import('@tanstack/start').Fetcher<undefined, {
10
+ export declare const getFormData: (ctx: FetchFnCtx) => Promise<{
10
11
  errorMap: {
11
12
  onServer: undefined;
12
13
  };
@@ -1,3 +1,4 @@
1
+ import { FetchFnCtx } from '@tanstack/start';
1
2
  import { ServerFormState } from './types.js';
2
3
 
3
4
  export declare const initialFormState: {
@@ -6,7 +7,7 @@ export declare const initialFormState: {
6
7
  };
7
8
  errors: never[];
8
9
  };
9
- export declare const getFormData: import('@tanstack/start').Fetcher<undefined, {
10
+ export declare const getFormData: (ctx: FetchFnCtx) => Promise<{
10
11
  errorMap: {
11
12
  onServer: undefined;
12
13
  };
@@ -1,4 +1,3 @@
1
- import { createServerFn } from "@tanstack/start";
2
1
  import { _tanstackInternalsCookie } from "./utils.js";
3
2
  const initialFormState = {
4
3
  errorMap: {
@@ -6,7 +5,7 @@ const initialFormState = {
6
5
  },
7
6
  errors: []
8
7
  };
9
- const getFormData = createServerFn("GET", async (_, ctx) => {
8
+ const getFormData = async (ctx) => {
10
9
  const data = await _tanstackInternalsCookie.parse(
11
10
  ctx.request.headers.get("Cookie")
12
11
  );
@@ -14,7 +13,7 @@ const getFormData = createServerFn("GET", async (_, ctx) => {
14
13
  if (!data)
15
14
  return initialFormState;
16
15
  return data;
17
- });
16
+ };
18
17
  export {
19
18
  getFormData,
20
19
  initialFormState
@@ -1 +1 @@
1
- {"version":3,"file":"getFormData.js","sources":["../../../src/start/getFormData.tsx"],"sourcesContent":["import { createServerFn } from '@tanstack/start'\nimport { _tanstackInternalsCookie } from './utils'\nimport type { ServerFormState } from './types'\n\nexport const initialFormState = {\n errorMap: {\n onServer: undefined,\n },\n errors: [],\n}\n\nexport const getFormData = createServerFn('GET', async (_, ctx) => {\n const data = (await _tanstackInternalsCookie.parse(\n ctx.request.headers.get('Cookie'),\n )) as undefined | ServerFormState<any>\n // Delete the cookie before it hits the client again¸\n ctx.request.headers.delete('Cookie')\n if (!data) return initialFormState\n return data\n})\n"],"names":[],"mappings":";;AAIO,MAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ,CAAC;AACX;AAEO,MAAM,cAAc,eAAe,OAAO,OAAO,GAAG,QAAQ;AAC3D,QAAA,OAAQ,MAAM,yBAAyB;AAAA,IAC3C,IAAI,QAAQ,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAG9B,MAAA,QAAQ,QAAQ,OAAO,QAAQ;AACnC,MAAI,CAAC;AAAa,WAAA;AACX,SAAA;AACT,CAAC;"}
1
+ {"version":3,"file":"getFormData.js","sources":["../../../src/start/getFormData.tsx"],"sourcesContent":["import { _tanstackInternalsCookie } from './utils'\nimport type { FetchFnCtx } from '@tanstack/start'\nimport type { ServerFormState } from './types'\n\nexport const initialFormState = {\n errorMap: {\n onServer: undefined,\n },\n errors: [],\n}\n\nexport const getFormData = async (ctx: FetchFnCtx) => {\n const data = (await _tanstackInternalsCookie.parse(\n ctx.request.headers.get('Cookie'),\n )) as undefined | ServerFormState<any>\n // Delete the cookie before it hits the client again¸\n ctx.request.headers.delete('Cookie')\n if (!data) return initialFormState\n return data\n}\n"],"names":[],"mappings":";AAIO,MAAM,mBAAmB;AAAA,EAC9B,UAAU;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ,CAAC;AACX;AAEa,MAAA,cAAc,OAAO,QAAoB;AAC9C,QAAA,OAAQ,MAAM,yBAAyB;AAAA,IAC3C,IAAI,QAAQ,QAAQ,IAAI,QAAQ;AAAA,EAAA;AAG9B,MAAA,QAAQ,QAAQ,OAAO,QAAQ;AACnC,MAAI,CAAC;AAAa,WAAA;AACX,SAAA;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-form",
3
- "version": "0.25.3",
3
+ "version": "0.26.1",
4
4
  "description": "Powerful, type-safe forms for React.",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -63,7 +63,7 @@
63
63
  "@tanstack/form-core": "0.25.3"
64
64
  },
65
65
  "devDependencies": {
66
- "@tanstack/start": "^1.42.1",
66
+ "@tanstack/start": "^1.43.13",
67
67
  "@types/react": "^18.3.3",
68
68
  "@types/react-dom": "^18.3.0",
69
69
  "@vitejs/plugin-react": "^4.3.0",
@@ -72,7 +72,7 @@
72
72
  "vite": "^5.1.4"
73
73
  },
74
74
  "peerDependencies": {
75
- "@tanstack/start": "^1.40.1",
75
+ "@tanstack/start": "^1.43.13",
76
76
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
77
77
  },
78
78
  "peerDependenciesMeta": {
@@ -1,5 +1,5 @@
1
- import { createServerFn } from '@tanstack/start'
2
1
  import { _tanstackInternalsCookie } from './utils'
2
+ import type { FetchFnCtx } from '@tanstack/start'
3
3
  import type { ServerFormState } from './types'
4
4
 
5
5
  export const initialFormState = {
@@ -9,7 +9,7 @@ export const initialFormState = {
9
9
  errors: [],
10
10
  }
11
11
 
12
- export const getFormData = createServerFn('GET', async (_, ctx) => {
12
+ export const getFormData = async (ctx: FetchFnCtx) => {
13
13
  const data = (await _tanstackInternalsCookie.parse(
14
14
  ctx.request.headers.get('Cookie'),
15
15
  )) as undefined | ServerFormState<any>
@@ -17,4 +17,4 @@ export const getFormData = createServerFn('GET', async (_, ctx) => {
17
17
  ctx.request.headers.delete('Cookie')
18
18
  if (!data) return initialFormState
19
19
  return data
20
- })
20
+ }