T
TanStack5mo ago
passive-yellow

notFound data always nested in data.data, and props.data type is unknown

Hello) In defaultNotFoundComponent, props.data is typed as unknown. At runtime, props.data is an object: { data: T, isNotFound: true, routeId: string }. The user-provided data T from return notFound({ data: T }) is unexpectedly nested under props.data.data repo: https://stackblitz.com/edit/tanstack-router-zzqpfdfg?file=src%2Fmain.tsx // need select post by id
//posts.$postId.tsx
loader: ({ context: { queryClient }, params: { postId } }) => {
return notFound({
data: 'Hello data',
});
//posts.$postId.tsx
loader: ({ context: { queryClient }, params: { postId } }) => {
return notFound({
data: 'Hello data',
});
// main.ts
defaultNotFoundComponent={(props) => {
return (
<div>
Error:
{JSON.stringify(props.data, null, 2)}
</div>
);
}}
// main.ts
defaultNotFoundComponent={(props) => {
return (
<div>
Error:
{JSON.stringify(props.data, null, 2)}
</div>
);
}}
6 Replies
extended-salmon
extended-salmon5mo ago
Hello, Would you be able to create an issue in the repository for this? I’ll look into the root cause and help resolve it 🙂
extended-salmon
extended-salmon5mo ago
Thanks! I’ll try to handle it as quickly as possible and open a PR soon!
passive-yellow
passive-yellowOP3mo ago
@Lee Hi! I just wanted to ask if the changes in this PR are still planned to be accepted — if they’re still relevant, I’d be happy to pick it up this weekend and help bring it to completion.
extended-salmon
extended-salmon3mo ago
Hello! Thanks for reaching out. From my perspective, I think the necessary work for this PR to be approved is already complete. However, because of the recent start-rc work, it seems the maintainers haven’t been able to give this PR much attention. As far as I know, that work wrapped up today, and I’m currently waiting for additional reviews from the maintainers. If you notice anything missing in the PR, please feel free to contribute — it would be more than welcome!

Did you find this page helpful?