Skip to content

Targeting _top causes duplicate requests #149

@imacrayon

Description

@imacrayon

Discussed in #147

Originally posted by nasermirzaei89 September 18, 2025
Here I have a login page:

https://github.com/nasermirzaei89/blog/blob/master/templates/login-page.gohtml#L10

<form method="post" action="/login" class="flex flex-col gap-2" x-target="login" x-target.away="_top">

and I set messages like error and success in the session, and on rendering page, I render and delete them.

in the login page, when I return error, it shows that as the notification section uses x-sync
https://github.com/nasermirzaei89/blog/blob/master/templates/page-footer.gohtml#L1

but on success, when I set the success message. it calls the page 2 times:
image

in the picture above, the first call response size is 2.4kb as it has the message rendered, but the second one is 2.3kb because the message renders only once.

So, the login message won't display after redirect.

Is there any suggested solution to it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions