Form submission or link_to duplicates whole page

I have weird behavior on one of my pages. When the form is submitted or link_to, which does deletion with confirmation, is clicked - the whole page content is duplicated. and added below </body>. Here’s what it looks like after 3 form submits (or link to clicks).

Here’s some code.

  resources :companies, only: %i[show new create edit update] do
    member do
      get "admin_members"
      post "add_admin_member"
      delete "remove_admin_member"
    end
  end

this is controller code for submission

  def add_admin_member
    member = AdminMember.new(admin_member_params)
    if member.save
      flash[:notice] = t("...")
      redirect_to admin_members_company_path(@company)
    else
      flash.now.alert = member.errors.full_messages
      render :admin_members, status: :unprocessable_entity
    end
  end

The form is very straightforward: form_with has 2 text fields. The link_to is also simple:

    link_to(
      remove_admin_member_company_path(member_id: member.id),
      method: :delete,
      data: { turbo_method: :delete, turbo_confirm: "Are you sure?" }
    ) do
      content_tag :span, "Delete"
    end

There are no JS errors or warnings (except when form validation fails, I get the 422 error message in the console)
What am I missing here?

Found the solution in Simple method delete with confirm - #4 by data6800

The issue was that the layout didn’t have html in the name - it was admin_member.erb instead of admin_members.html.erb