You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Props must be JSON.stringify-able otherwise, unclear js error is thrown.
So it'll be better to have a function to validate the props and display the relevant error and suggested fix.
happy to do a PR if you can point me in the right direction :)
The text was updated successfully, but these errors were encountered:
hey @nickreese
basically, we can check for this and throw a relevant errors like this.
try {
JSON.stringify(props);
} catch (e) {
throw new Error(`Elder.js only supports valid JSON in hydrate-client. Offending component: ${name}. Offending props: ${props}.`);
}
but here's the thing, when I was testing my component the same error is still thrown.
VM240:1 Uncaught (in promise) SyntaxError: Unexpected token N in JSON at position 0
It turns out the props I was sending are JSON.stringify() friendly. And for some reason, the above error is thrown because the props contain so many fields. When I remove for example say "description", the above error doesn't occur.
Sorry I could check to debug until here only, was caughtup in a producthunt launch :) (it became #2 product of the day :D )
Props must be JSON.stringify-able otherwise, unclear js error is thrown.
So it'll be better to have a function to validate the props and display the relevant error and suggested fix.
happy to do a PR if you can point me in the right direction :)
The text was updated successfully, but these errors were encountered: