-
Notifications
You must be signed in to change notification settings - Fork 393
Open
Description
Version
System:
OS: macOS 26.2
CPU: (12) arm64 Apple M3 Pro
Memory: 176.66 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 141.0.7390.124
Firefox Developer Edition: 147.0
Safari: 26.2
Safari Technology Preview: 26.0
npmPackages:
@edenx/app-tools: 1.70.2 => 1.70.2
@edenx/plugin-fetch: 1.70.2 => 1.70.2
@edenx/plugin-slardar-web: 1.70.2 => 1.70.2
@edenx/plugin-starling-intl: 1.70.2 => 1.70.2
@edenx/runtime: 1.70.2 => 1.70.2
@edenx/tsconfig: 1.70.2 => 1.70.2Details
note: This bug is on SSRd apps
My SSR project structure looks like:
src/routes/layout.tsxlayout.data.tsA/page.tsxpage.data.ts
B/page.tsx
Inside layout.data.ts I have some code like
// layout.data.ts
export const loader = ()=> {
return {
key1: {
subkey1: "subvalue1"
},
key2: "value2",
}
}and inside layout.tsx
// layout.tsx
const Layout = (): JSX.Element => {
const loaderData = useLoaderData() as LayoutData;
console.log({ loaderData });
console.log(loaderData.key1.subkey1);.
Inside A/page.data.ts I have something like
// A/page.data.ts
import { redirect } from "@edenx/runtime/router";
export const loader = ({request))=> {
let isProblem = new URL(request.url).searchParams.get("isProblem") === "true";
if (isProblem) {
return redirect("/A?isProblem=false");
} else {
return {
A: {
"aKey3: "value3",
}
}
}
}in A/page.tsx I have
// A/page.tsx
const A = ()=> {
const AData = useLoaderData() as CourseData;
console.log({AData});
}and finally inside B/page.tsx I have
const B = () => {
return (<>
<Link to="/A" />
<Link to="/A?isProblem=true" />
</>
)
}.
In my app, if I visit /B and click on the link to /A, if there is no problem in A/page.data.ts it works great. Inside my console I see logged
// fetch /A?__loader=layout&__ssrDirect=true
// fetch /A?__loader=A&__ssrDirect=true
{
loaderData: {
key1: {
subkey1: "subvalue1"
},
key2: "value2",
}
}
"subvalue1"
{
AData: {
A: {
"aKey3: "value3",
}
}
}
. However, clicking on /A?isProblem=true is bad. Here is what's logged:
// fetch /A?isProblem=true&__loader=layout&__ssrDirect=true
// fetch /A?isProblem=true&__loader=A&__ssrDirect=true RETURNS 204
// fetch /A?isProblem=false&__loader=A&__ssrDirect=true
{
loaderData: {
A: {
"aKey3: "value3",
}
}
}
TypeError: Cannot read properties of undefined (reading 'subkey1')
The BUG is that the loader data for A/page.data.ts is returned in layout.tsx. This shouldn't ever happen.
Reproduce link
I'm having trouble coming up with a minimal repo. I sent a maximal repo in the Lark EdenX group
Reproduce Steps
See above
Metadata
Metadata
Assignees
Labels
No labels