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

Showing Posts 1 to 2

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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews