Strange behavior when sending delete request in phoenix

I am following the phoenix book but using phoenix 1.6 instead.

At chapter 5, when implemented the logout function, I sent a delete request to clear the session. When I clicked the logout link, a submit button appeared at the bottom left of the page:

Here is the code of the link

<header>
      <section class="container">
        <nav role="navigation">
          <ul>
            <%= if @current_user do %>
              <li><%= @current_user.username %></li>
              <li>
                <%= link("Log out",
                  to: Routes.session_path(@conn, :delete, @current_user),
                  method: "delete"
                ) %>
              </li>
            <% else %>
              <li><%= link("Register", to: Routes.user_path(@conn, :new)) %></li>
              <li><%= link("Log in", to: Routes.session_path(@conn, :new)) %></li>
            <% end %>
          </ul>
        </nav>
        <a href="http://phoenixframework.org/" class="phx-logo">
          <img src={Routes.static_url(@conn, "/images/phoenix.png")} alt="Phoenix Framework Logo" />
        </a>
      </section>
    </header>

I made another delete route which only redirect to another page and had the same issue. When I tried to change the method of the test link to something else, the button didn’t appear.

Is it a known issue? how to fix it?

1 Like

Turned out that it is a bug in phoenix_html 3.3.0.

I reported it and Jose already pushed a fix.

2 Likes