Easy way to tell "loader" to not worry if value returned is actually serializable
We sometimes return complex objects with some values typed as "unkown" which the loader does not like at all. Is there an easy way to cast or tell the loader to ignore the fact that the returned value is not serializable?
3 Replies
exotic-emeraldOP•2mo ago
I already found it.
E.g.
return {
action: action as ChildUserAction & TsrSerializable,
};
is enough 👍
and for others. You can also set ssr: false just for that one route if you are not sure if the return value can be serialized or not 🙂
yammering-amber•2mo ago
why would you want to ignore this?
why not properly type it?
You can also set ssr: false well then you are not server side rendering. do you need SSR?exotic-emeraldOP•5w ago
You are absolutely right that fixing the types is the clean approach. It would be a lot of work in our case so I was just looking for an easy way out. We now use ssr:false as we really don't need data-only ssr anyway for those routes 👍