sodapopcan

sodapopcan

I’m having a bad time here and just posting to see if anyone can see what I’m doing wrong.

I’m using Flop Phoenix with streams. When I go to sort fields by clicking the header, the URL updates properly but nothing re-renders. Refreshing the page gives the desired results, so I figure there is nothing wrong with my business code. I’ve set it up according to the docs and no matter what I do, nothing seems to work. I’ve tried simplifying the table, configuring the stream with a different id function, and ore or less randomly changing the order of things, adding a mount function, removing the table opts, and so on. I’m sort of at my wit’s end for now so going to walk away for a bit, but I wanted to post here just in case someone can see what I’m doing wrong. I’m assuming it’s something really stupid.

Thanks in advance (and no problem if no one wants to help, lol).

Here is my whole liveview minus event handlers:

defmodule DesjWeb.Admin.Requests.IndexLive do
  @moduledoc false
  use DesjWeb, :live_view

  @impl true
  def handle_params(params, _uri, socket) do
    case Desj.Requests.list_open_requests(params) do
      {:ok, {requests, meta}} ->
        socket =
          socket
          |> stream(:requests, requests, reset: true)
          |> assign(:meta, meta)

        {:noreply, socket}

      {:error, _meta} ->
        {:noreply, push_navigate(socket, to: ~p"/admin/requests")}
    end
  end

  @impl true
  def render(assigns) do
    ~H"""
    <div :if={@meta.total_count == 0}>
      There are no requests at this time.
    </div>

    <Flop.Phoenix.table
      :if={@meta.total_count > 0}
      items={@streams.requests}
      meta={@meta}
      path={~p"/admin/requests"}
      opts={flop_table_opts(image?: true)}
    >
      <:col :let={{_, request}}>
        <.artwork artwork={request.artwork} />
      </:col>
      <:col :let={{_, request}} label="Artwork" field={:artwork_title}>
        <%= request.artwork.title %>
      </:col>
      <:col :let={{_, request}} label="User" field={:user_name}>
        <%= request.user.name %>
      </:col>
      <:col :let={{_, request}} label="Exclusivity?" field={:request_exclusivity}>
        <%= request.request_exclusivity %>
      </:col>
      <:col :let={{_, request}}>
        <div :if={request.status == :open} class="flex items-center gap-2">
          <form id={"reject-form-#{request.id}"} phx-submit="REJECT">
            <input type="hidden" name="request_id" value={request.id} />
            <.button kind={:reject}>Reject</.button>
          </form>

          <form id={"accept-form-#{request.id}"} phx-submit="ACCEPT">
            <input type="hidden" name="request_id" value={request.id} />
            <.button kind={:go}>Accept</.button>
          </form>
        </div>

        <div>
          <form
            :if={request.status == :rejected}
            id={"undo-reject-form-#{request.id}"}
            phx-submit="UNDO_REJECT"
          >
            <input type="hidden" name="request_id" value={request.id} /> Rejected
            <.button>Undo</.button>
          </form>
        </div>
      </:col>
    </Flop.Phoenix.table>
    """
  end
end

First 2 of 2 Posts Switch mode

sodapopcan

sodapopcan OP

Ohhhhh, thanks! I thought I was losing my mind. I found a few issues but they were old so assumed it wasn’t a thing anymore.

THANKS!!

PS: I’m aware I have some bare <form>s (it’s on the list)… no one reading this should take that as good style :upside_down_face:

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New

We're in Beta

About us Mission Statement