PhoenixKitWeb.Components.Core.LibraryLoadNotice (phoenix_kit v2.62.2)

Copy Markdown View Source

Tells an administrator, in the page, when a viewer/editor library failed to load — instead of leaving them a "half working" photo viewer and a console.error to find.

The libraries (Fresco, Tessera, Etcher, Leaf, SortableJS, Panzoom, wavesurfer) load lazily in the browser through the shared loadLibrary in phoenix_kit.js, which records each final failure and announces it as a pk:library-failed window event. This component renders a hidden shell carrying all the translated copy in data-* attributes; the LibraryLoadNotice hook fills it from the recorded failures and shows it. See dev_docs/plans/2026-10-07-self-hosted-viewer-libraries.md, Part A.

Rendered only for the active scope's Owner, Admin or superadmin — the people who can act on a deployment problem. Not Scope.can_access_admin_area?/1: that is true for any single-permission holder, a restricted media viewer included, who can do nothing about a Content-Security-Policy. Everyone else gets nothing new: the features degrade exactly as they did.

Sits beside the flash group in each layout shell (LayoutWrapper's branches and the dashboard), inside the LiveView tree; id keeps two shells on one page from colliding.

Summary

Functions

library_load_notice(assigns)

Attributes

  • scope (:any) - Defaults to nil.
  • id (:string) - Defaults to "pk-library-notice".