remix-live-loader
remix-live-loader copied to clipboard
Remix Single Fetch and the new unstable_data
Hi there,
Have you tried using remix-live-loader with the new single fetch and data object?
I am getting typescript errors..
This is my new stream loader...
import {
unstable_defineLoader as defineLoader,
} from '@remix-run/node'
export const loader = defineLoader(async ({ request, params, context }) => {
return createEventStream(request, [`data`])
})
then my route loader (using the new data structure for TurboStream)...
import {
unstable_data as data,
unstable_defineLoader as defineLoader,
} from '@remix-run/node'
return data(
{ mydata },
{
headers: {
'set-cookie': await emsSessionStorage(context).commitSession(session),
},
},
)
and in my routes and components...
const data = useLiveLoader<typeof loader>({})
now I would think that I could now use data.mydata and I can, however typescript throws an error and tells me that data.data.mydata is actually where the data is?