Replies: 1 comment
-
Ok so after trying to work around this in the meantime by doing a I've tried to replace that in my example with a custom class with a
That produces a huge number of React hydration errors and then Remix throws a timeout error even though its successfully rendered the initial page; I assume this is because when rendering server-side I'm happy to accept part of this is because I've just assumed too much about e.g. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have effectively the following:
Because determining the count of hours for a report can take more than a few seconds, I figured I would show a bit of UI so people knew the app was actually loading - based on the docs I expected I could just safely replace
json
withdefer
:Except it seems there is a difference when the initial server-side render is done: with
json
the data is always serialized soreport.createdAt
is an ISO string both server and client side, but withdefer
it remains an instance ofDate
server side and thus Luxon explodes due to expecting an ISO string to parse.I feel like this is probably a bug but wouldn't be surprised if it's not via "we can't always assume this should be JSON, that's the point of the
json
helper, etc"; if it isn't a bug then I think this should be made clear in the documentation along with how to properly handle this - currently it seems that maybe I need to manually doJSON.stringify
+JSON.parse
which seems pretty annoying...What's scarier (and is a bug if there isn't a bug in
defer
) is that the types don't convey this - TypeScript always expects that the data has been serialized regardless of usingdefer
orjson
.Beta Was this translation helpful? Give feedback.
All reactions