mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-09 20:37:47 +00:00
fix: NextJS should not throw an error anymore (#485)
* fix: remove use-isomorphic-layout-effect package for nextjs compatibility * chore: remove DOM from tsconfig * chore: fix formatting errors --------- Co-authored-by: Corbin Crutchley <git@crutchcorn.dev>
This commit is contained in:
@@ -62,8 +62,7 @@
|
||||
"dependencies": {
|
||||
"@tanstack/form-core": "workspace:*",
|
||||
"@tanstack/react-store": "0.1.3",
|
||||
"@tanstack/store": "0.1.3",
|
||||
"use-isomorphic-layout-effect": "^1.1.2"
|
||||
"@tanstack/store": "0.1.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.0 || ^18.0.0",
|
||||
|
||||
@@ -3,8 +3,8 @@ import { useStore } from '@tanstack/react-store'
|
||||
import type { DeepKeys, DeepValue, Narrow } from '@tanstack/form-core'
|
||||
import { FieldApi, functionalUpdate } from '@tanstack/form-core'
|
||||
import { useFormContext, formContext } from './formContext'
|
||||
import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect'
|
||||
import type { UseFieldOptions } from './types'
|
||||
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
|
||||
|
||||
declare module '@tanstack/form-core' {
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useStore } from '@tanstack/react-store'
|
||||
import React, { type ReactNode, useState } from 'react'
|
||||
import { type UseField, type FieldComponent, Field, useField } from './useField'
|
||||
import { formContext } from './formContext'
|
||||
import useIsomorphicLayoutEffect from 'use-isomorphic-layout-effect'
|
||||
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'
|
||||
|
||||
declare module '@tanstack/form-core' {
|
||||
// eslint-disable-next-line no-shadow
|
||||
|
||||
5
packages/react-form/src/useIsomorphicLayoutEffect.ts
Normal file
5
packages/react-form/src/useIsomorphicLayoutEffect.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { useEffect, useLayoutEffect } from 'react'
|
||||
|
||||
export const useIsomorphicLayoutEffect =
|
||||
// @ts-ignore
|
||||
typeof window !== 'undefined' ? useLayoutEffect : useEffect
|
||||
Reference in New Issue
Block a user