Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior of href tags #2726

Open
fushihara opened this issue Oct 20, 2024 · 1 comment
Open

Inconsistent behavior of href tags #2726

fushihara opened this issue Oct 20, 2024 · 1 comment

Comments

@fushihara
Copy link

fushihara commented Oct 20, 2024

The basePath may not be applied to the href attribute of the A tag.

https://fresh.deno.dev/docs/concepts/server-configuration#-basepath-2
The above document says that basePath is automatically reflected in the href attribute of the A tag, but the first A tag in the attached figure does not reflect basePath.

image

$ deno --version
deno 2.0.2 (stable, release, x86_64-pc-windows-msvc)
v8 12.9.202.13-rusty
typescript 5.6.2
@fushihara
Copy link
Author

I have confirmed a tentative response and will share it with you.
If you remove the async from the method on the second line, the basePath is applied to both links.
export default async function Page(req: Request, ctx: RouteContext) {
export default function Page(ctx: RouteContext) {

The relevant source code appears to be at
The A tag in question also executes this line of processing, but current is null and the value of basePath is not obtained.

if (typeof props.href === "string") {

    if (typeof props.href === "string") {
      props.href = withBase(props.href, current?.basePath);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant