alephjs / aleph.js

The Full-stack Framework in Deno.

Home Page:https://alephjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useData hook and whatever method of hydrating data is currently not adequately implemented.

Brocktho opened this issue · comments

I have run into a very damning issue with the current implementation of useData. It seems to scrub data from the user's returned json in certain circumstances. I've been unable to know the extent to which this happens however I can confirm a meta tag is always purged in dev mode and only initially purged in production mode, then eventually your meta tag returns after initial hydration is complete. I have an example repo of a minimum reproduction here and I have a production example of some of the issue here

In the production example, you'll notice that my data first comes in as a Date string and then is formatted into a toLocaleDateString(). This is because of the type purging initially and then once hydration is complete I am able to properly reconstruct the Date object and call .toLocaleDateString(). There are ways to get around this issue by simply making the transformation on the server side, but it would be nice to have control over my data and not have some of it randomly scrubbed, especially when I haven't been able to find all cases where this can happen.