Open History to see the last commit
1import {
2 deleteCookie,
3 getCookie,
4 setCookie,
5} from '@tanstack/react-start/server'
6import { parse, stringify } from 'devalue'
7β
8const _INTERNALS_COOKIE_NAME = '_tanstack_form_internals'
9β
10export const setInternalTanStackCookie = (data: any) => {
11 const cookie = stringify(data)
12 setCookie(_INTERNALS_COOKIE_NAME, cookie)
13}
14β
15export const getInternalTanStackCookie = () => {
16 const cookie = getCookie(_INTERNALS_COOKIE_NAME)
17 if (!cookie) return undefined
18 return parse(cookie)
19}
20β
21export const deleteInternalTanStackCookie = () => {
22 deleteCookie(_INTERNALS_COOKIE_NAME)
23}