diff --git a/core/assets/js/pdf_viewer.js b/core/assets/js/pdf_viewer.js index 56b77079f..b89f4bccb 100644 --- a/core/assets/js/pdf_viewer.js +++ b/core/assets/js/pdf_viewer.js @@ -5,7 +5,7 @@ const pdfjs = require("../node_modules/pdfjs-dist"); const worker = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjsVersion}/pdf.worker.min.js`; function renderPages(hook) { - hook.renderPagesIfNeeded(); + hook.renderPages(); } export const PDFViewer = { diff --git a/core/systems/assignment/crew_page.ex b/core/systems/assignment/crew_page.ex index b052507ef..7f1eefbe6 100644 --- a/core/systems/assignment/crew_page.ex +++ b/core/systems/assignment/crew_page.ex @@ -157,8 +157,13 @@ defmodule Systems.Assignment.CrewPage do @impl true def handle_event( "prepare_modal", - %{live_component: %{id: modal_id}} = modal, - %{assigns: %{modal: %{id: current_modal_id}, modal_visible: modal_visible}} = socket + %{live_component: %{ref: %{id: modal_id}}} = modal, + %{ + assigns: %{ + modal: %{live_component: %{ref: %{id: current_modal_id}}}, + modal_visible: modal_visible + } + } = socket ) do if modal_id == current_modal_id do {:noreply, socket |> assign(modal: modal)} @@ -179,8 +184,13 @@ defmodule Systems.Assignment.CrewPage do @impl true def handle_event( "show_modal", - %{live_component: %{id: modal_id}} = modal, - %{assigns: %{modal: %{id: current_modal_id}, modal_visible: modal_visible}} = socket + %{live_component: %{ref: %{id: modal_id}}} = modal, + %{ + assigns: %{ + modal: %{live_component: %{ref: %{id: current_modal_id}}}, + modal_visible: modal_visible + } + } = socket ) do if modal_id == current_modal_id do {:noreply, socket |> assign(modal: modal, modal_visible: true)} diff --git a/core/systems/assignment/crew_work_view.ex b/core/systems/assignment/crew_work_view.ex index 169a2d4b2..566728183 100644 --- a/core/systems/assignment/crew_work_view.ex +++ b/core/systems/assignment/crew_work_view.ex @@ -33,7 +33,7 @@ defmodule Systems.Assignment.CrewWorkView do ) do tool_started = Map.get(socket.assigns, :tool_started, false) tool_initialized = Map.get(socket.assigns, :tool_initialized, false) - first_time? = not Map.has_key?(socket.assigns, :work_items) + tasks_finished? = Map.get(socket.assigns, :tasks_finished?, tasks_finished?(work_items)) { :ok, @@ -51,9 +51,9 @@ defmodule Systems.Assignment.CrewWorkView do tester?: tester?, panel_info: panel_info, tool_started: tool_started, - tool_initialized: tool_initialized + tool_initialized: tool_initialized, + tasks_finished?: tasks_finished? ) - |> update_tasks_finished() |> update_selected_item_id() |> update_selected_item() |> compose_child(:work_list_view) @@ -61,14 +61,9 @@ defmodule Systems.Assignment.CrewWorkView do |> compose_child(:context_menu) |> update_tool_ref_view() |> update_child(:finished_view) - |> handle_finished_state(first_time?) } end - defp update_tasks_finished(%{assigns: %{work_items: work_items}} = socket) do - socket |> assign(tasks_finished: tasks_finished?(work_items)) - end - defp tasks_finished?(work_items) do task_ids = Enum.map(work_items, fn {_, task} -> task.id end) Crew.Public.tasks_finished?(task_ids) @@ -539,23 +534,19 @@ defmodule Systems.Assignment.CrewWorkView do socket |> assign(selected_item_id: selected_item_id) end - defp handle_finished_state(socket, false) do - # Dont show finished view after first load + defp handle_finished_state(%{assigns: %{panel_info: %{embedded?: true}}} = socket) do + # Dont show finished view when embedded in external panel UI socket end - defp handle_finished_state(socket, true) do - handle_finished_state(socket) - end - - defp handle_finished_state(%{assigns: %{panel_info: %{embedded?: true}}} = socket) do - # Dont show finished view when embedded in external panel UI + defp handle_finished_state(%{assigns: %{tasks_finished?: true}} = socket) do socket end defp handle_finished_state(%{assigns: %{work_items: work_items}} = socket) do if tasks_finished?(work_items) do socket + |> assign(tasks_finished?: true) |> signal_tasks_finished() |> compose_child(:finished_view) |> show_modal(:finished_view, :sheet) diff --git a/core/systems/feldspar/app_view.ex b/core/systems/feldspar/app_view.ex index 495836668..b23d2de93 100644 --- a/core/systems/feldspar/app_view.ex +++ b/core/systems/feldspar/app_view.ex @@ -9,7 +9,7 @@ defmodule Systems.Feldspar.AppView do @impl true def render(assigns) do ~H""" -
+
<%!-- Ensure that updates don't alter the hierarchy in front of the iframe. Changing the preceding siblings of the iframe would result in a reload of the iframe due to Morphdom (https://github.com/patrick-steele-idem/morphdom/issues/200).