Closed frontsideair closed 2 years ago
It actually works as designed. The problem is that you modified the loader return, but not how you used it in the route. It's basically telling you that you should be using
loaderData.data.today.toLocaleDateString()
If you think about it, that's pretty cool!
You're absolutely correct about this case, I botched the repro while trying to shrink it. The following is the correct reproduction and I removed the <p>
to reduce confusion.
return typedjson(
{ data: [{ greeting: "hello", today: new Date() }] },
);
I also updated the StackBlitz, it should be visible with the same url.
Ugh. You are correct. I copied the loader to the resource route so I could see what the actual payload was.
Meta should have been: { "data.0.today": "date" }
https://github-gbcwza-vh4vsh--3000.local.webcontainer.io/resource
This works now in v0.0.7. Thanks for the bug report!
https://stackblitz.com/edit/github-gbcwza-9pxd9e?file=app%2Froutes%2Ftest.tsx
When I wrap the loader data in another object, it fails while deserializing. Here's a reproduction: https://stackblitz.com/edit/github-gbcwza?file=app%2Froutes%2Ftest.tsx
The code: