sofn-xyz / mailing

Build, test, send emails with React
https://www.mailing.run
MIT License
3.6k stars 74 forks source link

React context works in export but not on preview #477

Open maxaggedon opened 11 months ago

maxaggedon commented 11 months ago

Describe the bug Consuming a react context with useContext(ThemeContext) yields an error :

TypeError: Cannot read properties of null (reading 'useContext')

To Reproduce Steps to reproduce the behavior:

  1. Create a context file
  2. Use the Provider in your layout
  3. Try to access value in your template
  4. See error when using yarn preview

Expected behavior Same rendering as in exported templates

Desktop (please complete the following information):

mnikolaus commented 10 months ago

Check these conversations https://github.com/sofn-xyz/mailing/issues/276 https://github.com/sofn-xyz/mailing/issues/426