Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]:TypeError: Cannot read properties of null (reading 'FormContext') #1556

Closed
2 tasks done
iamcsharper opened this issue Jun 21, 2024 · 0 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@iamcsharper
Copy link

iamcsharper commented Jun 21, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Usage of context with SSR throws error above in dev mode. No error in production build

TypeError: Cannot read properties of null (reading 'useFormContext')
    at FormField (D:/work/FitLab-front/src/components/Form/Field.tsx:44:41)
    at Module.createComponent (file:///D:/work/FitLab-front/node_modules/solid-js/dist/server.js:353:15)
    at get children [as children] (D:/work/FitLab-front/src/views/client/programs/[id]/index.tsx:53:39)
    at eval (D:/work/FitLab-front/src/components/Form/index.tsx:58:102)

Expected behavior 🤔

No response

Steps to reproduce 🕹

Steps:

  1. const Context = createContext({})
  2. const Parent = () => <Context.Provider value={{ foo: 'bar' } }>
  3. Parent.SubComponent = () => { const ctx = useContext(Context); return

    foo

    }
    4.
    <Parent.SubComponent />

    5.Error

Context 🔦

No response

Your environment 🌎

OS windows
"@macaron-css/solid": "^1.5.3",
    "@macaron-css/vite": "^1.5.1",
    "@solid-primitives/input-mask": "^0.2.2",
    "@solid-primitives/storage": "^3.7.1",
    "@solidjs/meta": "^0.29.4",
    "@solidjs/router": "^0.13.6",
    "@solidjs/start": "^1.0.2",
@iamcsharper iamcsharper added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant