Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
https://elderguide.com/tech/elderjs/
MIT License
2.11k stars 53 forks source link

Looking for clarification around hydrate-options #226

Closed apop880 closed 2 years ago

apop880 commented 2 years ago

I recently upgraded to the latest version of Elder.js and started getting this error when trying to build: SyntaxError: Unexpected token l in JSON at position 2

After poking around for quite a bit, I was able to fix this by putting quotes around the keys in the hydrate-options attribute for components.

Before: <ScrollToTop hydrate-client={{}} hydrate-options={{ loading: "eager" }} />

After <ScrollToTop hydrate-client={{}} hydrate-options={{ "loading": "eager" }} />

The first method matches what's currently in the docs but no longer seems to work. I was able to dig around for the fix by looking in https://github.com/Elderjs/elderjs/blob/e8435c2444698602dbd6e9bf945e7d17db38f862/src/partialHydration/__tests__/partialHydration.spec.ts

Is this a breaking change? If so, I didn't see it called out in any of the docs/release notes. Happy to put in a PR to update the docs as well but wanted to make sure I'm understanding the issue and fix properly first, and there isn't something I'm missing.