Hi, I’m using liveview for displaying different sections on the same page and navigate through them with pill butons and live navigation. I have a filter bar to customize the data showed on each section by time and different parameteres.
Basically what I do is when the user selects all the filters it requires it fires this event when pussing the Search Button:
def handle_event("apply_filters", _params, socket) do
keys = [:companies, :countries, :states, :listings, :agents]
Enum.map(keys, fn key ->
update_filters(key, socket.assigns)
end)
send(self(), :load_data)
{:noreply, assign(socket, loading: true)}
end
Which basically update the state of the filters on the socket and put a loading template while the load_data event fetch the required data to be shown on the template:
def handle_info(:load_data, %{assigns: assigns} = socket) do
data = fetch_data(assigns.event, assigns.start_date, assigns.end_date, assigns.filters)
{:noreply, assign(socket, loading: false, fetched_data: data)}
end
I noticed that when I apply the filter changes all the “clickable items” stop working, like links and pagination arrow buttons. Also, I noticed this get fixed if I use the navigation to go to another section.
So when using the search button, the data loads correctly but all of the pagination buttons get freeze also links I’m using to display modals, and it gets fixed if I navigate to another section and return to the first one. I haven’t been able to find the cause of this behavior.
I’ll appreciate any help, thanks in advance!!